www.digitalmars.com         C & C++   DMDScript  

c++ - Bug related to template constructor

Hi,

Here is the code:

-------------------------------------------- Cut here...
template <class T>
class File
{
public:
    template <class xchar>
    File <T> (const xchar *pszName)
    {}
};

int main ()
{
    File <char> f ("alfa.txt");
    return 0;
}
-------------------------------------------- ... and here !

The error message is:

        File <char> f ("alfa.txt");
                                  ^
main.cpp(12) : Error: cannot find constructor for class matching
File<char >::File<char >(char const *)

The code can be compiled with Borland >= 5.5.1, Visual >= 6.0,
Comeau >= 4.3.3.


Yours truly,
Adder
Oct 04 2006