This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c/6024: GCC fails to diagnose mismatch of enum types in prototype/function
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- To: <Richard dot Earnshaw at arm dot com>
- Cc: <rearnsha at arm dot com>, <gcc-gnats at gcc dot gnu dot org>, <gcc-bugs at gcc dot gnu dot org>
- Date: Thu, 21 Mar 2002 11:51:07 +0000 (GMT)
- Subject: 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