[Bug c++/63392] New: poor error recovery with missing typename
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Sep 27 19:05:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63392
Bug ID: 63392
Summary: poor error recovery with missing typename
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: manu at gcc dot gnu.org
template<typename T>
class A {
A(int i) : x(i) {}
T::type x;
};
$ g++ test.cc
test.cc:4:3: error: need ‘typename’ before ‘T::type’ because ‘T’ is a dependent
scope
T::type x;
^
A<T>::A(int)
test.cc:3:14: error: class ‘A<T>’ does not have any field named ‘x’
A(int i) : x(i) {}
^
$ clang++ test.cc
test.cc:4:3: error: missing 'typename' prior to dependent type name 'T::type'
T::type x;
^~~~~~~
typename
Of course it gets worse in the case of GCC if x is used later in the code.
More information about the Gcc-bugs
mailing list