This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/44871] Invalid type mismatches while merging C and C++ sources
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 26 Nov 2010 18:40:28 +0000
- Subject: [Bug c++/44871] Invalid type mismatches while merging C and C++ sources
- Auto-submitted: auto-generated
- References: <bug-44871-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44871
--- Comment #14 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2010-11-26 18:40:15 UTC ---
On Fri, 26 Nov 2010, rguenth at gcc dot gnu.org wrote:
> I'd like to hear opinions from C and C++ FE people as to why the current
> state illustrated in comment #6 makes sense and if the behavior can be
> commonized between C and C++.
C++ has special rules about using typedefs for anonymous structure types
for linkage purposes. C has no such rules. Thus, for C you can have
typedef struct { int a; } T1;
void f(T1);
in one translation unit and
typedef struct { int a; } T2;
void f(T2);
in another and they refer to the same function (cross-translation-unit
struct compatibility rules apply) - for C++ they do not (and are mangled
differently).