www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.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