[committed] c: C2x enums wider than int [PR36113]

2022-10-18 Thread Joseph Myers
C2x has two enhancements to enumerations: allowing enumerations whose values do not all fit in int (similar to an existing extension), and allowing an underlying type to be specified (as in C++). This patch implements the first of those enhancements. Apart from adjusting diagnostics to reflect th

Re: [committed] c: C2x enums wider than int [PR36113]

2022-10-18 Thread Jakub Jelinek via Gcc-patches
On Tue, Oct 18, 2022 at 02:08:40PM +, Joseph Myers wrote: > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/c2x-enum-1.c > @@ -0,0 +1,104 @@ > +/* Test C2x enumerations with values not representable in int. */ > +/* { dg-do compile } */ > +/* { dg-options "-std=c2x -pedantic-errors" } */ > + > +/*

Re: [committed] c: C2x enums wider than int [PR36113]

2022-10-19 Thread Joseph Myers
On Wed, 19 Oct 2022, Jakub Jelinek wrote: > > +/* Likewise, for overflow from long to long long. */ > > +#if __LONG_LONG_MAX__ > __LONG_MAX__ > > +enum e5 { e5a = __LONG_MAX__, > > + e5b, e5c, e5d = ((typeof (e5b)) -1) < 0, > > + e5e = (unsigned long) -1, > > + e5f, e5g = ((typeof (e5