lookup error message
Dimitri PAPADOPOULOS-ORFANOS
papadopo@shfj.cea.fr
Wed Jan 3 07:24:00 GMT 2001
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
More information about the Gcc-bugs
mailing list