http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54401
Bug #: 54401
Summary: Missing diagnostics about type-alias at class scope
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
The following simple and innocuous (ill-formed)
programs leads g++ in C++11 mode to produce a
very misleading unhelpful diagnostic:
gauss[3:28]% cat b.C
template<typename>
struct X {
using type = T;
};
When compiled with g++ in C++11 mode, I get:
gauss[3:32]% ~/gnu/bin/g++ -std=c++11 b.C
b.C:3:10: error: expected nested-name-specifier before 'type'
using type = T;
^
b.C:3:10: error: using-declaration for non-member at class scope
b.C:3:15: error: expected ';' before '=' token
using type = T;
^
b.C:3:15: error: expected unqualified-id before '=' token
(you need monospace fonts to make sense of the carets in the diagnostics)
The real problem is that `T' is undeclared (presumably a template
type parameter.)
I would expect the compiler to accept the syntax as a valid
alias declaration, and complain later that `T' isn't in scope.
In short it should be semantics error, not a parse error.