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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #2)
> Doesn't seem like valid code; clang++ trunk also rejects it:
> 94489.C:28:61: error: no matching constructor for initialization of
> 'std::plus<void>'
> 
> I think the fix should be
> 
> --- a/gcc/cp/pt.c
> +++ b/gcc/cp/pt.c
> @@ -3748,6 +3748,7 @@ expand_integer_pack (tree call, tree args,
> tsubst_flags_t complain,
>      }
>    else
>      {
> +      hi = instantiate_non_dependent_expr_sfinae (hi, complain);
>        hi = cxx_constant_value (hi);
>        int len = valid_constant_size_p (hi) ? tree_to_shwi (hi) : -1;
>  
> 
> but it'd be nice to have a reduced version.

This is not a complete fix because this one ICEs even with that:

template <typename, int...> struct b;
template <typename T, T... d> using e = b<T, __integer_pack(d)...>;
template <unsigned d> using f = e<unsigned, d>;
template <typename T> constexpr long g(T) { return 1l; }
struct array { };
template <typename> constexpr unsigned h{};
template<typename T, long dim = g(h<T>), class X = decltype(f<dim>{})> struct k
{ int n; };

template<typename T, typename U>
auto m(T t, U)
{
  [t] <unsigned> () {
      m(array{}, array{});
      return k<T, 1>::n;
  };
}

Reply via email to