https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93377
Bug ID: 93377 Summary: [10 Regression] ICE in tsubst_pack_expansion, at cp/pt.c:12852 Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gcc-bugs at marehr dot dialup.fu-berlin.de Target Milestone: --- The following code worked in gcc9 and below, but fails with a recent snapshot of gcc ```c++ struct empty {}; template <typename c> c value; template <typename c> auto func(value<c>); template <typename, typename...> struct alignment_algorithm; template <typename... args_t> struct select { template <typename algorithm_t, typename... _args_t> decltype(algorithm_t()(func<_args_t>...)) choose(); template <typename...> static empty choose(); using type = decltype(choose<alignment_algorithm<int>, args_t...>()); }; template <typename, typename... args_t> struct select_algorithm : select<args_t...> {}; template <typename, typename = void> struct maybe_value { int value; }; template <typename cn> struct maybe_value<cn, typename cn::sfinae>; struct function { template <typename algorithm_t, typename = decltype( maybe_value<select_algorithm<algorithm_t, int>>::value)> function(algorithm_t); }; template <typename> struct alignment_configuration_traits { static constexpr bool is_vectorised = 0; }; template <typename config_t, typename...> struct alignment_algorithm { using traits_t = alignment_configuration_traits<config_t>; template <typename indexed_sequence_pairs_t> void operator()(indexed_sequence_pairs_t) requires traits_t::is_vectorised; }; int main() { function{alignment_algorithm<int>{}}; } ``` (I couldn't reduce it any more, maybe someone else can help with it) produces the following ICE (https://godbolt.org/z/6uK11R): ``` > g++-git -std=c++17 -fconcepts -c ice.cpp // or g++-git -std=c++2a -c ice.cp ice.cpp: In instantiation of ‘void alignment_algorithm< <template-parameter-1-1>, <template-parameter-1-2> >::operator()(indexed_sequence_pairs_t) requires traits_t<config_t, <template-parameter-1-2>...>::is_vectorised [with indexed_sequence_pairs_t = int; config_t = int; <template-parameter-1-2> = {}]’: ice.cpp:17:25: required by substitution of ‘template<class algorithm_t, class ... _args_t> decltype (algorithm_t()(func<_args_t>...)) select<int>::choose<algorithm_t, _args_t ...>() [with algorithm_t = alignment_algorithm<int>; _args_t = {int}]’ ice.cpp:22:68: required from ‘struct select<int>’ ice.cpp:37:13: recursively required by substitution of ‘template<class cn> struct maybe_value<cn, typename cn::sfinae> [with cn = select_algorithm<alignment_algorithm<int>, int>]’ ice.cpp:37:13: required by substitution of ‘template<class algorithm_t, class> function::function(algorithm_t) [with algorithm_t = alignment_algorithm<int>; <template-parameter-1-2> = <missing>]’ ice.cpp:58:40: required from here ice.cpp:17:25: internal compiler error: in tsubst_pack_expansion, at cp/pt.c:12852 17 | decltype(algorithm_t()(func<_args_t>...)) choose(); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ 0x601131 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:12852 0x770121 tsubst_template_args(tree_node*, tree_node*, int, tree_node*) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:13111 0x775368 tsubst_argument_pack(tree_node*, tree_node*, int, tree_node*) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:13073 0x7700f4 tsubst_template_args(tree_node*, tree_node*, int, tree_node*) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:13123 0x76c46a tsubst(tree_node*, tree_node*, int, tree_node*) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:14985 0x777997 tsubst_qualified_id /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:16002 0x76742f tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:19259 0x760e34 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:18932 0x760e34 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:18590 0x681222 satisfy_constraint_r /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/constraint.cc:2499 0x681998 satisfy_constraint /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/constraint.cc:2575 0x682c14 satisfy_declaration_constraints /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/constraint.cc:2593 0x682ed8 constraint_satisfaction_value /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/constraint.cc:2708 0x682ed8 constraints_satisfied_p(tree_node*) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/constraint.cc:2729 0x64f2c1 add_function_candidate /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/call.c:2281 0x65175c add_template_candidate_real /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/call.c:3440 0x651ce6 add_template_candidate /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/call.c:3481 0x651ce6 add_candidates /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/call.c:5827 0x656d14 add_candidates /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/call.c:5742 0x656d14 build_op_call_1 /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/call.c:4777 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://bugs.archlinux.org/> for instructions. ``` ``` > g++-git --version g++-git (GCC) 10.0.1 20200119 (experimental) Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ```