This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

lookup error message


Hi,

This is an improvement request :

* GCC version
  	gcc version 2.95.2 19991024 (release)
  	gcc version 2.95.3 20010101 (prerelease)

* system type
  	i686-pc-linux-gnu
	sparc-sun-solaris2.7

* command line that triggers the bug
  	g++ foo.cc

* compiler output
  	foo.cc:14: syntax error before `;

* preprocessed file
  	See attached source file

The source looks like this:
	void foo()
	{
	}
	
	template < typename T >
	struct A
	{
	  typedef T foo;
	};
	
	template < typename T >
	struct B : A< T >
	{
	  foo x;
	};

The error message could be made more meaningful. For example
the program below
	struct foo
	{
	};
	
	template < typename T >
	struct A
	{
	  typedef T foo;
	};
	
	template < typename T >
	struct B : A< T >
	{
	  foo x;
	};
triggers the following warning:
	foo.cc:14: warning: lookup of `foo' finds `struct foo'
	foo.cc:14: warning:   instead of `typename B<T>::foo' from dependent 
base class
	foo.cc:14: warning:   (use `typename B::foo' if that's what you meant)

By the way, sorry to ask this here, but is the attached code really
invalid or is this a GCC bug? A pointer to a paragraph of the C++
standard anyone?

Dimitri Papadopoulos
void foo()
{
}

template < typename T >
struct A
{
  typedef T foo;
};

template < typename T >
struct B : A< T >
{
  foo x;
};

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]