[Bug c++/46589] struct member function not declared global
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Nov 21 18:04:00 GMT 2010
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46589
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-11-21 17:51:27 UTC ---
typedef struct { void G() ; } L ;
void L::G() { }
This is not the same type as L in main.cpp and the error is correct, L::G is
not defined
What you've defined is {unnamed type in L0.cpp}::G and that's not the same
function as {type L in main.cpp}::G
it's confusing because you've used the typedef L in both files, but that
doesn't make it the same type, and more than this would:
// file1.cpp
typedef struct X { void f(); } L;
// file2.cpp
typedef struct Y { void g(); } L;
Clearly you have two different typedefs called L here (which is an ODR
violation) and not a single type.
More information about the Gcc-bugs
mailing list