How can I make the following code compile under gcc-4.1.2
Stefan Schunck
Stefan.Schunck@pdf.de
Thu Feb 15 15:49:00 GMT 2007
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
More information about the Gcc-help
mailing list