c/6024: GCC fails to diagnose mismatch of enum types in prototype/function
Joseph S. Myers
jsm28@cam.ac.uk
Thu Mar 21 03:56:00 GMT 2002
The following reply was made to PR c/6024; it has been noted by GNATS.
From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: <Richard.Earnshaw@arm.com>
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:51:07 +0000 (GMT)
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
More information about the Gcc-prs
mailing list