https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94628

--- Comment #7 from Nicholas Krause <xerofoify at gmail dot com> ---
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.

Reply via email to