-
Compiler Confused
F:\C++\t1_\t1.cpp(109) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Error executing cl.exe.
PHP Code:
class a{
public:
template <class b>
class c{};
};
template <class e, class f>
class h: public e{
public:
e::c<f> g;
};
MSVC doesn't compile this, even if no class is instantiated, if i rename c in class a, it will show a bunch of errors instead of the above. Anyone have any ideas why?
Anyone with any other compiler that can compile this, so that I can see if it is something impossible in C++ or if it's just the poor MSVC compiler that sucks.
-
Either your code has a typo or it cannot possibly work (it can't now):
e::c<f> g;
This line is absolutely impossible. You assume that e is a class with a included template class named c. It could work if you declared it as
a::c<f> g;
but even then you risk h being derived from any data type, like ints, floats or enums! It could well be that this produces the error.
-
I tried. It compiles if you change e::c to a::c.
-
it's an acceptable solution, but it freaks me out that i have to leave some generic programming out :/
-
yeah, but the compiler just can't assume that there's an embedded class/struct/enum named c in the template parameter e. Maybe in future releases, but I don't think so.