https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119445
Bug ID: 119445 Summary: ICE: tree check: expected template_decl, have error_mark in build_deduction_guide, at cp/pt.cc:30483 Product: gcc Version: unknown Status: UNCONFIRMED Keywords: ice-checking, ice-on-invalid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rush102333 at gmail dot com Target Milestone: --- Test Input: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ template<bool> struct test; template<class X> struct non_type_param { template<class Y> struct B { template<class Z, test<Z::value> = 0> B(Z); }; }; non_type_param<int>::B ntp = 5; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Stack Dump: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <source>:4:44: error: non-type template parameters of class type only available with '-std=c++20' or '-std=gnu++20' [-Wtemplate-body] 4 | template<class Z, test<Z::value> = 0> B(Z); | ^ <source>:8:30: internal compiler error: tree check: expected template_decl, have error_mark in build_deduction_guide, at cp/pt.cc:30483 8 | non_type_param<int>::B ntp = 5; | ^ 0x291f785 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x2936756 internal_error(char const*, ...) ???:0 0x9d9fa2 tree_check_failed(tree_node const*, char const*, int, char const*, ...) ???:0 0xd11abd do_auto_deduction(tree_node*, tree_node*, tree_node*, int, auto_deduction_context, tree_node*, int, tree_node*) ???:0 0xbc7a71 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int, cp_decomp*) ???:0 0xcf21b3 c_parse_file() ???:0 0xe545f9 c_common_parse_file() ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ See https://godbolt.org/z/qsWTT4oMb