[Bug c++/60842] New: In-class initializer causes a strange error
kariya_mitsuru at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Apr 14 17:35:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60842
Bug ID: 60842
Summary: In-class initializer causes a strange error
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: kariya_mitsuru at hotmail dot com
The sample code below causes a strange error.
=========================== source code ===========================
namespace N {
class I {};
}
template <typename, typename>
class J {};
class S {
J<int, N::I> j = J<int, N::I>{};
};
int main() {}
=========================== source code ===========================
========================== error messages ==========================
prog.cc:9:32: error: invalid use of '::'
J<int, N::I> j = J<int, N::I>{};
^
prog.cc:9:32: error: expected ';' at end of member declaration
prog.cc:9:33: error: expected unqualified-id before '>' token
J<int, N::I> j = J<int, N::I>{};
^
prog.cc:9:24: error: wrong number of template arguments (1, should be 2)
J<int, N::I> j = J<int, N::I>{};
^
prog.cc:6:7: error: provided for 'template<class, class> class J'
class J {};
^
========================== error messages ==========================
I think that the sample code should be compiled successfully.
cf. http://melpon.org/wandbox/permlink/h96WGv3EW3DOyHnB
More information about the Gcc-bugs
mailing list