How can I make the following code compile under gcc-4.1.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

the following code compiled under gcc-3.4.6 and 3.3.6 but not any longer under
4.1.2. 

18: error: prototype for 'typename A<T>::B::type A<T>::B::f()' does not match any in class 'A<T>::B'
13: error: candidate is: typename A<T>::type A<T>::B::f()
18: error: template definition of non-template 'typename A<T>::B::type A<T>::B::f()'

template < typename T > class A 
{
	typedef int type;
	class B;
};

template < typename T >
class A<T>::B
{
	typedef typename A<T>::type type;
	type g() { return 0;}
	type f();
};

template < typename T >
typename A<T>::B::type 
A<T>::B::f() { return 0; }

Is the code invalid? 
Inlined function g compiles.

thanks, Stefan


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux