This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: typename bug ?
Alexandre Oliva wrote:
>
> On Nov 27, 1998, Miniussi <miniussi@ilog.fr> wrote:
>
> > I have some problems with typename, and I m not sure if the
> > problem is with egcs or with my understanding of the standard:
>
> > since the names declared in A<T> are not suppose to be
> > considered until instanciation os B<int>, it seems that a typename
> > is missing
>
> Nope. `typename' can only precede qualified names. You should write
> `typename A<T>::ptr'
I know... let say that a typename A<T>:: is missing if you
prefer.
> > (HP aCC 1.15 flags (1) as an error, but Dec cxx 6.1 does not)
>
> The code is correct, as long as `ptr' is found to be a type at
> template instantiation time.
Why is it correct ? The compiler can say that the code is
correct at line (1) if it can assume that ptr is a type, which
is possible only if :
1) it looks at the default base class and ignore the
fact that an 'a' specialization is not required to declare
a ptr type
2) assume that anything at that position is a type.
I fail to see 1 in the standard and I didn't really checked
for 2 (but it would indicate that you can put any token at
that place...).
> > Moreover, if you uncoment (3), the program compiles without problem
>
> Which is correct. The name is found a template parse time, so it is
> not considered a dependent name, and is bound before instantiation.
And a struct some_struct* is initialized with an int * ?
Alain