On Tue, 21 May 2024, Martin Uecker wrote:

> > The constraint violated is the general one "If an identifier has no 
> > linkage, there shall be no more than one declaration of the identifier (in 
> > a declarator or type specifier) with the same scope and in the same name 
> > space, except that: ... enumeration constants and tags may be redeclared 
> > as specified in 6.7.3.3 and 6.7.3.4, respectively." (where 6.7.3.3 says 
> > "Enumeration constants can be redefined in the same scope with the same 
> > value as part of a redeclaration of the same enumerated type." - as the 
> > redefinition is not with the same value, the "as specified in 6.7.3.3" is 
> > not satisfied and so the general constraint against redeclarations with no 
> > linkage applies).
> 
> This assumes that the value in question is the one of the initializer and not 
> the
> one after initialization (with no clear rules how this works in this case), 

There are no initializers here.  The constant-expression after '=' in the 
syntax for enumerator is not an initializer, and none of the rules for 
initializers apply to it.  (If the initializer with an out-of-range value 
also gets used in an expression, the constraint on constants would be 
violated, "Each constant shall have a type and the value of a constant 
shall be in the range of representable values for its type." - but the 
constraint on multiple declarations applies whether it's used or not.)

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

Reply via email to