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

Richard Earnshaw rearnsha@arm.com
Thu Mar 21 03:36:00 GMT 2002


The following reply was made to PR c/6024; it has been noted by GNATS.

From: Richard Earnshaw <rearnsha@arm.com>
To: "Joseph S. Myers" <jsm28@cam.ac.uk>
Cc: rearnsha@arm.com, gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org
Subject: Re: c/6024: GCC fails to diagnose mismatch of enum types in 
 prototype/function
Date: Thu, 21 Mar 2002 11:30:58 +0000

 > 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-prs mailing list