Topic: Is this a legal class template?


Author: dHarrison@worldnet.att.net (Doug Harrison)
Date: 1997/07/31
Raw View
Can someone comment on the legality of the following?

struct A
{
   typedef int I;
};

template<class T,class U = typename T::I>
struct B
{
};

B<A> b;

I didn't find anything in the Dec-96 DWP to indicate it should be
disallowed. I believe the use of typename is required, but VC5 chokes
on it with the message, "typename cannot be used outside a template
declaration"; it compiles it fine if I remove typename. On the other
hand, gcc 2.7.2 requires typename, rejecting the code if I remove it.

--
Doug Harrison
dHarrison@worldnet.att.net
---
[ 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         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]