https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102547
Bug ID: 102547 Summary: g++ 11. ICE with NTTPs and partial specialization Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: bob.steagall.cpp at gmail dot com Target Milestone: --- The following C++ source code: --------------------------------------------------------------------------- template<int... VALS> struct vals {}; template<class V, class A> struct vals_client {}; template<int V0, int V1, typename A> struct vals_client<vals<V0, V1>, A> {}; template<int V0, int V1> struct vals_client<vals<V0, V1>, void> {}; void testfn() { vals_client<vals<1, 2>, int> ci; //- OK vals_client<vals<1, 2>, void> cv; //- "sorry, unimplemented..., ICE" } --------------------------------------------------------------------------- When compiled with gcc 11.X generates this error: nttp_test.cpp: In function 'void testfn()': nttp_test.cpp:18:36: sorry, unimplemented: unexpected AST of kind nontype_argument_pack 18 | vals_client<vals<1, 2>, void> cv; //- "sorry, unimplemented..." | ^~ nttp_test.cpp:18: confused by earlier errors, bailing out --------------------------------------------------------------------------- When compiled with gcc trunk on godbolt.org, it elicits an ICE: <source>: In function 'void testfn()': <source>:23:36: sorry, unimplemented: unexpected AST of kind nontype_argument_pack 23 | vals_client<vals<1, 2>, void> cv; //- "sorry, unimplemented..., ICE" | ^~ <source>:23:36: internal compiler error: in potential_constant_expression_1, at cp/constexpr.c:9051 0x1fe73f9 internal_error(char const*, ...) ???:0 0x7d40a7 fancy_abort(char const*, int, char const*) ???:0 0x8475ff potential_constant_expression(tree_node*) ???:0 0xa21bd7 instantiation_dependent_expression_p(tree_node*) ???:0 0xa21c46 uses_template_parms(tree_node*) ???:0 0xa72888 most_specialized_partial_spec(tree_node*, int) ???:0 0xa7f834 instantiate_class_template(tree_node*) ???:0 0x89e107 start_decl_1(tree_node*, bool) ???:0 0x8c552f start_decl(cp_declarator const*, cp_decl_specifier_seq*, int, tree_node*, tree_node*, tree_node**) ???:0 0xa08395 c_parse_file() ???:0 0xb8f562 c_common_parse_file() ???:0 Please submit a full bug report, ... --------------------------------------------------------------------------- Testing with various version on godbolt.org reveals that the ICE does not occur with 10.X, 9.X, 8.X, or 7.X (that's as far back as I went).