https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94628
--- Comment #10 from Nicholas Krause <xerofoify at gmail dot com> --- (In reply to Martin Liška from comment #8) > (In reply to Nicholas Krause from comment #7) > > After adding this it seems to work for me, Patrick: > > case TYPE_ARGUMENT_PACK: > > if (value_dependent_expression_p(TREE_TYPE(*tp))) > > return *tp; > > if (TEMPLATE_TYPE_PARAMETER_PACK(*tp)) > > return *tp; > > return NULL_TREE; > > > > and gives me: > > test.c: In function ‘std::common_type_t<decltype > > (forward<F>(f)(std::integral_constant<int, i>(), > > (forward<decltype(args)>)(args)...)), decltype > > (forward<F>(f)(int_constant<Is>(), (forward<decltype(args)>)(args)...))...> > > select(int, F&&, Args&& ...)’: > > test.c:14:12: warning: ‘if constexpr’ only available with ‘-std=c++17’ or > > ‘-std=gnu++17’ > > 14 | if constexpr(sizeof...(Is)>0) > > | ^~~~~~~~~ > > test.c: In function ‘std::common_type_t<decltype > > (forward<F>(f)(std::integral_constant<int, i>(), > > (forward<decltype(select::args)>)(select::args)...)), decltype > > (forward<F>(f)(int_constant<Is>(), > > (forward<decltype(select::args)>)(select::args)...))...> select(int, F&&, > > Args&& ...) [with int I = 1; int ...Is = {}; F = t(int)::<lambda(auto:1)>; > > Args = {}]’: > > test.c:17:1: warning: control reaches end of non-void function > > [-Wreturn-type] > > 17 | } > > | ^ > > > > with no segfault. I'm not sure if this is the correct part to add this test > > for TYPE_ARGUMENT_PACK or if we would prefer it to be lower in the stack. > > The suggested change is wrong: > > /home/marxin/Programming/gcc2/objdir/./gcc/xgcc -shared-libgcc > -B/home/marxin/Programming/gcc2/objdir/./gcc -nostdinc++ > -L/home/marxin/Programming/gcc2/objdir/x86_64-pc-linux-gnu/libstdc++-v3/src > -L/home/marxin/Programming/gcc2/objdir/x86_64-pc-linux-gnu/libstdc++-v3/src/. > libs > -L/home/marxin/Programming/gcc2/objdir/x86_64-pc-linux-gnu/libstdc++-v3/ > libsupc++/.libs -B/usr/local/x86_64-pc-linux-gnu/bin/ > -B/usr/local/x86_64-pc-linux-gnu/lib/ -isystem > /usr/local/x86_64-pc-linux-gnu/include -isystem > /usr/local/x86_64-pc-linux-gnu/sys-include -x c++-header -nostdinc++ -g > -O2 -D_GNU_SOURCE > -I/home/marxin/Programming/gcc2/objdir/x86_64-pc-linux-gnu/libstdc++-v3/ > include/x86_64-pc-linux-gnu > -I/home/marxin/Programming/gcc2/objdir/x86_64-pc-linux-gnu/libstdc++-v3/ > include -I/home/marxin/Programming/gcc2/libstdc++-v3/libsupc++ -O2 -g > -std=gnu++0x > /home/marxin/Programming/gcc2/libstdc++-v3/include/precompiled/stdc++.h \ > -o x86_64-pc-linux-gnu/bits/stdc++.h.gch/O2ggnu++0x.gch > In file included from > /home/marxin/Programming/gcc2/objdir/x86_64-pc-linux-gnu/libstdc++-v3/ > include/cmath:42, > from > /home/marxin/Programming/gcc2/libstdc++-v3/include/precompiled/stdc++.h:41: > /home/marxin/Programming/gcc2/objdir/x86_64-pc-linux-gnu/libstdc++-v3/ > include/bits/cpp_type_traits.h:89:63: internal compiler error: tree check: > expected template_type_parm or template_template_parm or > bound_template_template_parm, have tree_list in instantiation_dependent_r, > at cp/pt.c:26926 > 89 | enum { __value = bool(_Sp::__value) || bool(_Tp::__value) }; > | ^ > 0x8404c2 tree_check_failed(tree_node const*, char const*, int, char const*, > ...) > ../../gcc/tree.c:9727 > 0x69234b tree_check3(tree_node*, char const*, int, char const*, tree_code, > tree_code, tree_code) > ../../gcc/tree.h:3327 > 0x69234b instantiation_dependent_r > ../../gcc/cp/pt.c:26926 > 0x13749b3 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), > void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*, > tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), > void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*)) > ../../gcc/tree.c:11996 > 0xb10a88 cp_walk_subtrees(tree_node**, int*, tree_node* (*)(tree_node**, > int*, void*), void*, hash_set<tree_node*, false, > default_hash_traits<tree_node*> >*) > ../../gcc/cp/tree.c:5061 > 0x1374a47 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), > void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*, > tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), > void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*)) > ../../gcc/tree.c:12019 > 0x1377c85 walk_tree_without_duplicates_1(tree_node**, tree_node* > (*)(tree_node**, int*, void*), void*, tree_node* (*)(tree_node**, int*, > tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, > default_hash_traits<tree_node*> >*)) > ../../gcc/tree.c:12352 > 0xa97c87 instantiation_dependent_uneval_expression_p(tree_node*) > ../../gcc/cp/pt.c:27033 > 0xa9e278 instantiation_dependent_expression_p(tree_node*) > ../../gcc/cp/pt.c:27043 > 0x973ba7 is_nondependent_constant_expression(tree_node*) > ../../gcc/cp/constexpr.c:8300 > 0x973fca fold_non_dependent_expr_template > ../../gcc/cp/constexpr.c:6970 > 0xa98147 build_non_dependent_expr(tree_node*) > ../../gcc/cp/pt.c:27531 > 0xb271ef build_x_binary_op(op_location_t const&, tree_code, tree_node*, > tree_code, tree_node*, tree_code, tree_node**, int) > ../../gcc/cp/typeck.c:4245 > 0xa54e71 cp_parser_binary_expression > ../../gcc/cp/parser.c:9719 > 0xa5671e cp_parser_assignment_expression > ../../gcc/cp/parser.c:9859 > 0xa556cd cp_parser_constant_expression > ../../gcc/cp/parser.c:10153 > 0xa62028 cp_parser_enumerator_definition > ../../gcc/cp/parser.c:19479 > 0xa62028 cp_parser_enumerator_list > ../../gcc/cp/parser.c:19419 > 0xa62028 cp_parser_enum_specifier > ../../gcc/cp/parser.c:19350 > 0xa62028 cp_parser_type_specifier > ../../gcc/cp/parser.c:17680 > > Can you please next time send patch suggestion that at least survive GCC > build? I just tested this with config: ../gcc/configure --enable-lanuages=c,c++ --enable-threads -disable-multilibs --enable-checking=yes --prefix="$HOME/obdjir" I've attached the building patch above as build on a GNU Cauldron power machine. No idea why it's not building for you but if you need me your config I will look into why if the patch still does not build for.