lookup error message
Martin Sebor
sebor@roguewave.com
Thu Jan 4 10:56:00 GMT 2001
Dimitri PAPADOPOULOS-ORFANOS wrote:
>
> Hi,
>
> This is an improvement request :
>
...
> The source looks like this:
> void foo()
> {
> }
>
> template < typename T >
> struct A
> {
> typedef T foo;
> };
>
> template < typename T >
> struct B : A< T >
> {
> foo x;
> };
>
...
>
> By the way, sorry to ask this here, but is the attached code really
> invalid or is this a GCC bug?
The code is not valid, the warning in the second (legal) example is a gcc bug
(see http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=708&database=gcc ).
> A pointer to a paragraph of the C++
> standard anyone?
14.6.2, p3: In the definition of a class template or in the definition of a
member of such a template that appears outside of the template definition, if a
base class of this template depends on a template-parameter, the base class
scope is not examined during name lookup until the class template is
instantiated. [Example:
typedef double A;
template<class T> B {
typedef int A;
};
template<class T> struct X : B<T> {
A a; // a has type double
};
Regards
Martin
>
> Dimitri Papadopoulos
>
> --------------------------------------------------------------------------------
>
> foo.ccName: foo.cc
> Type: Plain Text (TEXT/plain)
More information about the Gcc-bugs
mailing list