https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101247
Bug ID: 101247 Summary: ICE when using static constexpr bool defined in base-class in derived class constructor requires-clause Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lewissbaker.opensource at gmail dot com Target Milestone: --- Compiling the following code with GCC trunk and flags: -std=c++20 ``` template<typename T> struct in_place_type_t {}; template<typename T> inline constexpr in_place_type_t<T> in_place_type; template<typename T, typename... Ts> inline constexpr bool outer_helper_v = true; template<typename... Ts> struct foo { struct type; template<typename U> static constexpr bool helper_v = outer_helper_v<U, Ts...>; }; template<typename... Ts> struct foo<Ts...>::type { template<typename U> requires helper_v<U> type(in_place_type_t<U>) {} }; int main() { foo<int>::type x(in_place_type<int>); } ``` results in an internal compiler-error ``` <source>: In substitution of 'template<class U> requires helper_v<U> foo<int>::type::type(in_place_type_t<T>) [with U = {int}]': <source>:26:40: required from here <source>:21:18: internal compiler error: tree check: accessed elt 1 of 'tree_vec' with 0 elts in tsubst_pack_expansion, at cp/pt.c:13084 21 | requires helper_v<U> | ^~~~~~~~~~~ 0x1d4c179 internal_error(char const*, ...) ???:0 0x685746 tree_vec_elt_check_failed(int, int, char const*, int, char const*) ???:0 0x99e0bc tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*) ???:0 0x9afa62 tsubst_template_args(tree_node*, tree_node*, int, tree_node*) ???:0 0x9b064b tsubst_argument_pack(tree_node*, tree_node*, int, tree_node*) ???:0 0x9afa04 tsubst_template_args(tree_node*, tree_node*, int, tree_node*) ???:0 0x983ebd tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0x7abcda constraints_satisfied_p(tree_node*, tree_node*) ???:0 0x9c26c3 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool, bool) ???:0 0x74abc9 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, tree_node**, int) ???:0 0x74c8c0 build_special_member_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, int) ???:0 0x8611c8 build_aggr_init(tree_node*, tree_node*, int, int) ???:0 0x81f0d9 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ???:0 0x94f36d c_parse_file() ???:0 0xad2922 c_common_parse_file() ???:0 ``` See https://godbolt.org/z/ebnxfsMs9 for an example.