Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2004-05-27 10:20:32


On May 27, 2004, at 10:05 AM, Vladimir Prus wrote:

>> I've sent a reduced test case to the Metrowerks front end engineer.
>
> Thanks.
>
>> In
>> the meantime I can think of two workarounds:
>>
>> 1. Specialize the entire basic_config_file_iterator class on wchar_t.
>> or
>
> This might be a good idea, especially since two other compilers --
> borland and
> VC7 have problems with the same member function specialization.
>
>> 2. Provide an inlined definition for the specialized member in the
>> header.
>
> Do you think that would help?

Here's my reduced test case:

#include <string>

struct base
{
        virtual bool getline(std::string& s) = 0;
};

template <class charT>
struct derived
        : public base
{
        bool getline(std::string& s);
};

template <>
//inline
bool
derived<wchar_t>::getline(std::string&);// {return false;}

template <class charT>
bool
derived<charT>::getline(std::string&)
{
        char test[sizeof(charT) == 1];
        return true;
}

int main()
{
        std::string s;
        derived<char> c;
        c.getline(s);
        derived<wchar_t> w;
        w.getline(s);
}

Error : data type is incomplete
  (instantiating: 'derived<wchar_t>::getline(std::basic_string<char,
std::char_traits<char>, std::allocator<char>> &)')
HelloWorld.cp line 24 char test[sizeof(charT) == 1];

If I give the specialization a definition, it compiles and runs
correctly at least on Pro 9. Sorry I don't have Pro 8 loaded to test
on.

Btw our FE engineer has gotten back to me, confirmed this is a bug, and
it has already been fixed in our latest compiler (post-Pro 9, not yet
released).

-Howard


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk