Archives
D Programming
DD.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++ - Internal error: el.c 1988
/* When trying to instantiate a template function that uses 1. a type parameter and 2. a non-type template parameter of the previously defined type, the compiler complains of an illegal type cast from "<type represented by T> to T". This error doesn't make any sense since T represents the type I'm converting from; T by itself isn't a real type. An attempt to specialize the function (#define SPECIALIZE) also results in Internal error: el.c 1988 Note that a class template with the same parameters works fine. I'm using DMC 8.45.6n I don't know if this is standard syntax, but MSVC 7.1 and GCC 3.4.4 don't have a problem with this (with or without SPECIALIZE). */ #define BUG #define SPECIALIZE #ifdef BUG template <class T, T Value> void f() { } #ifdef SPECIALIZE template <> void f<bool, true>() { } template <> void f<bool, false>() { } #endif //SPECIALIZE #endif //BUG template <class T, T Value> class myclass { public: T f() { return Value; } }; int main() { #ifdef BUG f<bool, true>(); #endif //BUG myclass<bool, true> myvar; //note that this works fine myvar.f(); } Sep 25 2005
|