[Bug c++/58871] New: [4.7/4.8/4.9 Regression] [c++11] ICE with defaulted copy constructor in broken template class hierarchy
reichelt at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Oct 25 09:09:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58871
Bug ID: 58871
Summary: [4.7/4.8/4.9 Regression] [c++11] ICE with defaulted
copy constructor in broken template class hierarchy
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: reichelt at gcc dot gnu.org
The following invalid code snippet (compiled with "-std=c++11" or "-std=c++0x"
for older compilers) triggers an ICE since GCC 4.6.0:
========================================================
template<typename T> struct A : virtual T
{
A();
A(const A&);
};
template<typename T> A<T>::A(const A<T>&) = default;
A<int> a = A<int>();
========================================================
bug.cc: In instantiation of 'struct A<int>':
bug.cc:9:8: required from here
bug.cc:1:29: error: base type 'int' fails to be a struct or class type
template<typename T> struct A : virtual T
^
bug.cc:7:22: internal compiler error: in implicitly_declare_fn, at
cp/method.c:1660
template<typename T> A<T>::A(const A<T>&) = default;
^
0x6b0bd0 implicitly_declare_fn(special_function_kind, tree_node*, bool,
tree_node*, tree_node*)
../../gcc/gcc/cp/method.c:1660
0x6b470e defaulted_late_check(tree_node*)
../../gcc/gcc/cp/method.c:1780
0x5cc4f4 tsubst_decl
../../gcc/gcc/cp/pt.c:10537
0x5b9634 tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:11323
0x5e75db instantiate_class_template_1
../../gcc/gcc/cp/pt.c:8927
0x5e75db instantiate_class_template(tree_node*)
../../gcc/gcc/cp/pt.c:9236
0x6784eb complete_type(tree_node*)
../../gcc/gcc/cp/typeck.c:132
0x561589 start_decl_1(tree_node*, bool)
../../gcc/gcc/cp/decl.c:4679
0x58b2f1 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
../../gcc/gcc/cp/decl.c:4642
0x663dba cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:16526
0x66569f cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:11066
0x6495e0 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:10947
0x6708fe cp_parser_declaration
../../gcc/gcc/cp/parser.c:10844
0x66f61a cp_parser_declaration_seq_opt
../../gcc/gcc/cp/parser.c:10730
0x670f36 cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:3990
0x670f36 c_parse_file()
../../gcc/gcc/cp/parser.c:30999
0x78e183 c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1046
Please submit a full bug report, [etc.]
More information about the Gcc-bugs
mailing list