https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67735
Bug ID: 67735 Summary: internal compiler error while trying to use __direct_bases to create parallel hierarchy of classes Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: piotrwn1 at gmail dot com Target Milestone: --- When used new extensions of __direct_bases to create parallel hierarchy of classes - I got the internal compiler error. Link to online compiler with this issue: http://melpon.org/wandbox/permlink/JJiMLfGJWth94oV2#wandbox-resultwindow-code-body-5 I know this is about experimental feature - but since asked then - here you are: #include <type_traits> template <typename T> class CallUp : public CallUp<__direct_bases(T)>... { public: CallUp(T* obj) : CallUp<__direct_bases(T)>(obj)..., obj(obj) { } ~CallUp() { obj->resetThis(); } private: T* obj; }; template <typename T> auto callUp(T* obj) { return CallUp<T>(obj); } class Foo0 { public: using Base = NoBase; void resetThis() { std::cout << "reset Foo0\n"; } void reset() { callUp(this); } }; class Foo1 : public Foo0 { public: using Base = Foo0; void resetThis() { std::cout << "reset Foo1\n"; } void reset() { callUp(this); } }; class Foo2 : public Foo1 { public: using Base = Foo1; void resetThis() { std::cout << "reset Foo2\n"; } void reset() { callUp(this); } }; int main() { Foo2 foo2; foo2.reset(); } The output: prog.cc:4:48: internal compiler error: Segmentation fault class CallUp : public CallUp<__direct_bases(T)>... ^ 0xa6c33f crash_signal /home/heads/gcc/gcc-source/gcc/toplev.c:353 0x5cd1b2 xref_basetypes(tree_node*, tree_node*) /home/heads/gcc/gcc-source/gcc/cp/decl.c:12866 0x638e04 cp_parser_class_head /home/heads/gcc/gcc-source/gcc/cp/parser.c:21382 0x638e04 cp_parser_class_specifier_1 /home/heads/gcc/gcc-source/gcc/cp/parser.c:20642 0x638e04 cp_parser_class_specifier /home/heads/gcc/gcc-source/gcc/cp/parser.c:20938 0x638e04 cp_parser_type_specifier /home/heads/gcc/gcc-source/gcc/cp/parser.c:15298 0x6499fb cp_parser_decl_specifier_seq /home/heads/gcc/gcc-source/gcc/cp/parser.c:12264 0x656ee8 cp_parser_single_declaration /home/heads/gcc/gcc-source/gcc/cp/parser.c:25064 0x657212 cp_parser_template_declaration_after_parameters /home/heads/gcc/gcc-source/gcc/cp/parser.c:24756 0x657a2e cp_parser_explicit_template_declaration /home/heads/gcc/gcc-source/gcc/cp/parser.c:24991 0x657a2e cp_parser_template_declaration_after_export /home/heads/gcc/gcc-source/gcc/cp/parser.c:25009 0x65c8e9 cp_parser_declaration /home/heads/gcc/gcc-source/gcc/cp/parser.c:11631 0x65adca cp_parser_declaration_seq_opt /home/heads/gcc/gcc-source/gcc/cp/parser.c:11553 0x65b0e5 cp_parser_translation_unit /home/heads/gcc/gcc-source/gcc/cp/parser.c:4169 0x65b0e5 c_parse_file() /home/heads/gcc/gcc-source/gcc/cp/parser.c:34539 0x71cee2 c_common_parse_file() /home/heads/gcc/gcc-source/gcc/c-family/c-opts.c:1064 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.