https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105228
Bug ID: 105228 Summary: [9/10/11/12 Regression] ICE tree check: expected tree that contains 'decl minimal' structure, have 'error_mark' in decl_anon_ns_mem_p, at cp/tree.cc:3826 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gs...@t-online.de Target Milestone: --- Started with r7 : (gcc configured with --enable-checking=yes) $ cat z1.cc template<template<void> class> struct A { template<typename ... Args> static void foo() { foo(); } }; $ g++-12-20220410 -c z1.cc z1.cc:1:19: error: 'void' is not a valid type for a template non-type parameter 1 | template<template<void> class> struct A | ^~~~ z1.cc: In substitution of 'template<template<<typeprefixerror><anonymous> > class<template-parameter-1-1> > template<class ... Args> static void A< <template-parameter-1-1> >::foo() [with Args = <missing>; <template-parameter-1-1> = {}]': z1.cc:4:26: required from here z1.cc:4:15: internal compiler error: tree check: expected tree that contains 'decl minimal' structure, have 'error_mark' in decl_anon_ns_mem_p, at cp/tree.cc:3826 4 | static void foo() { foo(); } | ^~~ 0x6c9ab3 tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*) ../../gcc/tree.cc:8953 0xa1b4ac contains_struct_check(tree_node const*, tree_node_structure_enum, char const*, int, char const*) ../../gcc/tree.h:3827 0xa1b4ac decl_anon_ns_mem_p(tree_node const*) ../../gcc/cp/tree.cc:3826 0x8182b7 determine_visibility(tree_node*) ../../gcc/cp/decl2.cc:2867 0x9ae8bf tsubst_function_decl ../../gcc/cp/pt.cc:14305 0x9924f3 tsubst_decl ../../gcc/cp/pt.cc:14585 0x97ad67 tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/cp/pt.cc:15565 0x9b4cb2 instantiate_template_1 ../../gcc/cp/pt.cc:21625 0x9b4cb2 instantiate_template(tree_node*, tree_node*, int) ../../gcc/cp/pt.cc:21684 0x9bc656 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool, bool) ../../gcc/cp/pt.cc:22150 0x72543b add_template_candidate_real ../../gcc/cp/call.cc:3544 0x7265a1 add_template_candidate ../../gcc/cp/call.cc:3636 0x7265a1 add_candidates ../../gcc/cp/call.cc:6176 0x736240 add_candidates ../../gcc/cp/call.cc:10994 0x736240 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, tree_node**, int) ../../gcc/cp/call.cc:11038 0x9e7dde finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ../../gcc/cp/semantics.cc:2791 0x9189d8 cp_parser_postfix_expression ../../gcc/cp/parser.cc:7880 0x92ffb1 cp_parser_unary_expression ../../gcc/cp/parser.cc:9029 0x8fd91f cp_parser_cast_expression ../../gcc/cp/parser.cc:9933 0x8fe1e1 cp_parser_binary_expression ../../gcc/cp/parser.cc:10035