M
Marco Jez
The following code reproduces a problem I'm having with the GCC compiler. It
compiles fine on MSVC, so I'm wondering whether it is legal C++ code or not.
template<typename C>
struct Provider
{
template<typename T>
static void func() {}
};
template<typename C, typename Pro>
struct Client
{
void create()
{
Pro::func<C>(); // compiler stops here
}
};
int main()
{
Client<int, Provider<double> > cli;
cli.create();
return 0;
}
The GNU compiler gives me a "parse error" at this line:
Pro::func<C>();
Note that if parameter T in Provider::func() was deducible automatically
(for example through a function argument), the code would compile. It seems
that the explicit template specialization above confuses the compiler.
Am I doing something wrong?
Cheers,
Marco
compiles fine on MSVC, so I'm wondering whether it is legal C++ code or not.
template<typename C>
struct Provider
{
template<typename T>
static void func() {}
};
template<typename C, typename Pro>
struct Client
{
void create()
{
Pro::func<C>(); // compiler stops here
}
};
int main()
{
Client<int, Provider<double> > cli;
cli.create();
return 0;
}
The GNU compiler gives me a "parse error" at this line:
Pro::func<C>();
Note that if parameter T in Provider::func() was deducible automatically
(for example through a function argument), the code would compile. It seems
that the explicit template specialization above confuses the compiler.
Am I doing something wrong?
Cheers,
Marco