This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/46589] struct member function not declared global
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 21 Nov 2010 23:14:51 +0000
- Subject: [Bug c++/46589] struct member function not declared global
- Auto-submitted: auto-generated
- References: <bug-46589-4@http.gcc.gnu.org/bugzilla/>
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.