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]

[Bug c++/44871] Invalid type mismatches while merging C and C++ sources


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).


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