This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project. See the libstdc++ home page for more information.
>>>>> Mark Mitchell <mark@markmitchell.com> writes:
> (By the way, since the example below is mine, I would have appreciated
> being in the loop on whatever discussion was taking place about it.)
I was discussing it on the C++ committee reflector.
> In any case, we need to understand under exactly which circumstances
> these things match. John, do you have a proposal handy? For example,
> what about:
> template <class T>
> struct B {
> enum E { a = 1
> /* So that John will be happy with the array. :-) */
> };
> };
> template <class T>
> struct D : public B<T> {
> static T t[B<T>::a];
> };
> template <class T>
> T S<T>::t[S<T>::a];
> In the same way as for my original example, you can reason that
> `S<T>::a' must refer to the same thing as `B<T>::a', even though
> `B<T>::a' is dependent, and not resolved in the first phase of lookup.
I assume you mean the defn to use D<T>, not S<T>. In any case, it's not
the same, because B<int>::a can be something else due to a specialization
of B<int>, but if S<int> is specialized, we don't use the template for
S<T>::t anyway, so it's moot.
> There is no `a' in `S<T>' proper, so if `S<T>::a' is going to make
> sense at all, it must be because it is in fact `B<T>::a'. Is the
> compiler supposed to figure this out though? What if the last line
> says just plain `a', not `S<T>::a'?
Ill-formed, since 'a' is not used in a dependent context.
Jason