On Sat, 1 Jun 2024, Martin Uecker wrote:

> This is a new version of the patch.  I changed the overflow warning to
> an error and added your other example to the test case.
> 
> Bootstrapped and regression tested on x86_64.
> 
> 
>     c23: Fix for redeclared enumerator initialized with different type 
> [PR115109]
>     
>     c23 specifies that the type of a redeclared enumerator is the one of the
>     previous declaration.  Convert initializers with different type 
> accordingly
>     and emit an error when the value does not fit.
>     
>     2024-06-01 Martin Uecker  <uec...@tugraz.at>
>     
>     PR c/115109
>     
>     gcc/c/
>             * c-decl.cc (build_enumerator): When redeclaring an
>             enumerator convert value to previous type.  For redeclared
>             enumerators use underlying type for computing the next value.
>     
>     gcc/testsuite/
>             * gcc.dg/pr115109.c: New test.
>             * gcc.dg/c23-tag-enum-6.c: New test.
>             * gcc.dg/c23-tag-enum-7.c: New test.

OK.

-- 
Joseph S. Myers
josmy...@redhat.com

Reply via email to