https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111890
Harry Butterworth <heb1001 at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |heb1001 at gmail dot com --- Comment #6 from Harry Butterworth <heb1001 at gmail dot com> --- I have hit this bug, I think. My simplified test case as follows: struct O {}; template<class E> struct A { struct B { template<int F> struct C; template<int F> requires ( F == 0 ) struct C<F> { template<class G> struct D {}; }; template<int F> requires ( F > 0 ) struct C<F> : public C<F - 1> { template<class G> struct D : public C<F - 1>::D<G> { friend O & operator << ( O & o, D const & d ) { return o; } }; }; }; }; int main() { A<int>::B::C<1>::D<int> d; return 0; } ~$ /usr/local/gcc-14.1.0/bin/g++-14.1.0 --std=c++20 try.cc try.cc: In instantiation of ‘struct A<int>::B::C<1>::D<int>’: try.cc:29:29: required from here 29 | A<int>::B::C<1>::D<int> d; | ^ try.cc:21:28: internal compiler error: Segmentation fault 21 | friend O & operator << ( O & o, D const & d ) { return o; } | ^~~~~~~~ 0xf001ef crash_signal ../.././gcc/toplev.cc:319 0x7fcc3f1ce51f ??? ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0 0x92b9f0 tsubst_friend_function ../.././gcc/cp/pt.cc:11468 0x92b9f0 instantiate_class_template(tree_node*) ../.././gcc/cp/pt.cc:12679 0x9671ed complete_type(tree_node*) ../.././gcc/cp/typeck.cc:138 0x7e737b start_decl_1(tree_node*, bool) ../.././gcc/cp/decl.cc:6184 0x802d89 start_decl_1(tree_node*, bool) ../.././gcc/cp/decl.cc:6150 0x802d89 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int, tree_node*, tree_node*, tree_node**) ../.././gcc/cp/decl.cc:6150 0x8e177d cp_parser_init_declarator ../.././gcc/cp/parser.cc:23486 0x8b81a4 cp_parser_simple_declaration ../.././gcc/cp/parser.cc:15900 0x8dc9d0 cp_parser_declaration_statement ../.././gcc/cp/parser.cc:14936 0x8e3878 cp_parser_statement ../.././gcc/cp/parser.cc:12892 0x8bb007 cp_parser_statement_seq_opt ../.././gcc/cp/parser.cc:13418 0x8bb20f cp_parser_compound_statement ../.././gcc/cp/parser.cc:13272 0x8dcacd cp_parser_function_body ../.././gcc/cp/parser.cc:25987 0x8dcacd cp_parser_ctor_initializer_opt_and_function_body ../.././gcc/cp/parser.cc:26038 0x8e132e cp_parser_function_definition_after_declarator ../.././gcc/cp/parser.cc:32730 0x8e247a cp_parser_function_definition_from_specifiers_and_declarator ../.././gcc/cp/parser.cc:32647 0x8e247a cp_parser_init_declarator ../.././gcc/cp/parser.cc:23366 0x8b81a4 cp_parser_simple_declaration ../.././gcc/cp/parser.cc:15900