Template meta programming problem with g++

Aurélien FILEZ kinju59@gmail.com
Fri Jul 19 18:13:00 GMT 2013


Hello,

This code compiles on MSVC but not on G++ :

==================================

template<int I>
class B
{
public:
	static void SomeMethod()
	{
		A::SomeMethod();
	}
};

class A
{
public:
	static void SomeMethod();
};

void test()
{
	B<3>::SomeMethod();
}


==================================

The error with g++ is :
test.cpp: In static member function "static void B<I>::SomeMethod()":
test.cpp:7:3: error: "A" has not been declared

Is there is a option to indicate to g++ to evaluate the template
functions only when a specialization is called, and not before ?

Thank you very much !



More information about the Gcc-help mailing list