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++/46589] struct member function not declared global


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46589

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-11-21 23:14:45 UTC ---
There might still be a bug here, just not demonstrated very well by the
original testcase.  Here's a version where the definitions of S agree, but gcc
still defines S::f as local and so the program fails to link:

// file1.cc
typedef struct { int f(); } S;

int main()
{
  S s;
  return s.f();
}

// file2.cc
typedef struct { int f(); } S;

int S::f() { return 0; }

I'm not sure if [basic.link] paragraph 5 means S::f should have external
linkage or not. Paragraph 4 (third bullet) means that S has external linkage.
Paragraph 5 refers to the name of the class and in this case the class has no
name, but it has the typedef name for linkage purposes.  I'm not sure if that
means S::f should or should not have external linkage.


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