This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++] Unreviewed patches
Jason Merrill wrote:
>
> > PR3391
> > http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00898.html
>
> OK. Would it make sense to do this for TYPENAME_TYPEs as well?
We can define a class like
template <class T> class C : public T::N { };
According to the standard, "T::N" should not be prefixed by
"typename" here. But a TYPENAME_TYPE is created for the base
class (in uniform with other typename cases). So TYPE_BINFO
of TYPENAME_TYPE may also be used.
> > Template parm dependent template template arg
> > http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00664.html
>
> This construct can appear outside of template args; consider
>
> template <class T> struct A {
> T::template N<int> n;
> };
>
> struct B {
> template <class T> struct N { };
> };
>
> A<B> a;
>
The above code should be "typename T::template N<int> n;".
The current GCC can handle this well. It builds a
TEMPLATE_ID_EXPR and wraps it in a TYPENAME_TYPE. There is a
difference between the case in this patch and the one in your
example. The patch is intended to deal with this construct
WITHOUT its template argument. Like "C<T::template N>".
This can only appear as template argument.
> Also, the construct isn't just an identifier, it names a class template, so
> the name should suggest such. Perhaps UNBOUND_CLASS_TEMPLATE?
OK I'll adjust its name. A revised version will be submitted
later.
> > Name of class template not a valid template template arg
> > http://gcc.gnu.org/ml/gcc-patches/2001-07/msg00787.html
>
> No. I think this is an unintended consequence of the wording of the
> resolution of issue 176; we just wanted to say that the injected name could
> be used either as a class or as a template, so I would expect this code to
> be valid. I'll bring it up at the meeting on the 23rd.
OK, I'll wait and see how it turns out before doing anything about
it.
--Kriang