Topic: DR 224 and 14.6p6


Author: noway@sorry.com ("Giovanni Bajo")
Date: Mon, 5 May 2003 01:10:21 +0000 (UTC)
Raw View
Hello,

I was reading the proposed resolution for DR 224
(http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html#224), which
clarifies when a name is really dependent (and not sintatically dependent).
This also means that a qualified name whose qualifier is the injected class
name is not dependent. This is clearly shows by the examples that will be
added to    14.6.2.1.

But the proposed resolution says nothing about    14.6p6. In my copy of the
standard, I read:

--------------------------------------------------------
Within the definition of a class template or within the definition of a
member of a class template, the keyword typename is not required when
referring to the unqualified name of a previously declared member of the
class template that declares a type. The keyword typename shall always be
specified when the member is referred using a qualified name, even if the
qualifier is simply the class template name. [Example:

template <class T> struct A {
        typedef int B;
        A::B b; // ill-formed: typename required before A::B
        void f(A<T>::B); // ill-formed: typename required before A<T>::B
        typename A::B g(); // OK
};

The keyword typename is required whether the qualified name is A or A<T>
because A or A<T> are synonyms within a class template with the parameter
list <T>. ]
--------------------------------------------------------

Now, this is clearly the opposite of what stated in DR 224, so I suppose
that the proposed resolution should modify this. Am I missing something?

Moreover, it also raises another little problem: what if the member was not
previously declared? For instance:

template <class T> struct A {
        A::B b;    // ill-formed?
        typename A::B b;   // this was accepted before, because the name was
dependent, but now?

        typename int B;
};

Thanks
--
Giovanni Bajo

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]