c/6024: GCC fails to diagnose mismatch of enum types in prototype/function

Richard Earnshaw rearnsha@arm.com
Thu Mar 21 07:12:00 GMT 2002


> The types are compatible, which means these declarations are OK.  (Unless
> you use -fshort-enums, in which case the type in the prototype disagrees
> with the promoted type from the non-prototype definition.)


I *might* accept that argument if -Wall gave a diagnostic message for 
this.  However, I don't see why this case is any different from

struct s1 {int a, int b};
struct s2 {int c, int d};

void f(struct s1 *);

void f(x)
  struct s2 *x;
{
  return;
}

s1 and s2 are 'compatible'; but they aren't the same.  Where in the 
standard does it say that enum types are 'weak' like this?



More information about the Gcc-bugs mailing list