http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53856
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Known to fail| |3.4.3, 4.1.2, 4.6.3, 4.8.0
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-07-04
16:43:53 UTC ---
Modifying the example to use a member template of a non-template, which I
believe *is* valid, gets rejected:
struct A
{
template<typename T>
struct B;
};
template<typename T = int>
struct A::B
{
int i;
};
int main()
{
A::B<int> b = { };
return b.i;
}
bug.cc:8:11: error: default argument for template parameter for class enclosing
'struct A::B<T>'
This seems to be completely backwards, the invalid case is accepted and the
valid case rejected!
Comeau online rejects it for the same reason as the code in commnt 0 above:
"ComeauTest.c", line 6: error: a default template argument cannot be specified
on
the declaration of a member of a class template outside of its class
template<typename T = int>
^
The wording is much better than G++'s, but I think the error is wrong, as it
talks about a member of a class template, whereas the code above is a member
template of a class. Not the same thing.
Clang++ and Solaris CC accept the modified version.