This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Thu, 21 Mar 2002, Richard Earnshaw wrote:

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

> 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?

s1 and s2 aren't compatible.  Compatibility is defined in 6.2.7#1,
augmented by 6.7.2.2#4 (which specifies that enumerated types are
compatible with char or a signed or unsigned integer type) and some other
clauses.  There are rules about when structure types in different
translation units are compatible, but nothing that would make s1 and s2
compatible in any case.  (However, I can't see anything that says that two
enumerated types compatible with "int" (say) are compatible with each
other either, so it isn't clear what's intended here.)

-- 
Joseph S. Myers
jsm28@cam.ac.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]