-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Description
| Bugzilla Link | 8748 |
| Resolution | FIXED |
| Resolved on | Feb 04, 2011 06:22 |
| Version | trunk |
| OS | Linux |
| CC | @DougGregor |
Extended Description
Clang does accept both of the following
// Testcase 1
struct A { template struct B; };
template struct A::B { };
// Testcase 2
template struct A { template struct B; };
template template struct A::B { };
The draft standard n3225 however says at [temp.param]p9 (and C++03 uses wording too, to that effect there):
"A default template-argument shall not be specified in the template-parameter-lists of the definition of a member of a class template that appears outside of the member's class."
So Testcase 2 seems to be ill-formed. Incidentally, Clang doesn't compile Testcase 2 if we want to make use of the default argument, as in "A::B<>".
I'm not exactly sure how much of it is QoI and how much is required to be diagnosed. If we do not make use of the default argument, then clang doesn't complain at all if we say "A::B".
However here the ill-formeness doesn't occur in the definition of the default argument, but with its mere presence in the definition, so if we require the definition of "A::B" but not the definition of the default argument, I can't clearly cut the border of where required diagnostics end and QoI starts. It would seem to be easy to diagnose the default argument nontheless to me, already when its definition is parsed.