The following invalid tests ICE because we don't diagnose (and drop) bare
parameter packs in bitfield widths.
2021-03-25 Jakub Jelinek <jakub@redhat.com>
PR c++/99745
* decl2.c (grokbitfield): Diagnose bitfields containing bare parameter
packs and don't set DECL_BIT_FIELD_REPRESENTATIVE in that case.
* g++.dg/cpp0x/variadic181.C: New test.
&& !INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (TREE_TYPE (width)))
error ("width of bit-field %qD has non-integral type %qT", value,
TREE_TYPE (width));
- else
+ else if (!check_for_bare_parameter_packs (width))
{
/* Temporarily stash the width in DECL_BIT_FIELD_REPRESENTATIVE.
check_bitfield_decl picks it from there later and sets DECL_SIZE
--- /dev/null
+// PR c++/99745
+// { dg-do compile { target c++11 } }
+
+template <typename... Ts>
+struct S { int a : sizeof(Ts); }; // { dg-error "parameter packs not expanded with '\.\.\.':" }
+S<int> s; // { dg-message "'Ts'" "" { target *-*-* } .-1 }
+template <int... Ns>
+struct T { int a : Ns; }; // { dg-error "parameter packs not expanded with '\.\.\.':" }
+T<0> t; // { dg-message "'Ns'" "" { target *-*-* } .-1 }