This is the mail archive of the gcc-patches@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]

Re: typedef-named class member functions can be public


On Jul  5, 2002, Alexandre Oliva <aoliva@redhat.com> wrote:

> Whereas for non-inline functions, it appears to me that my patch
> would at least be an improvement over what we have now, even if it
> might still cause problems in corner cases.

Except that it only fixes the name in the translation unit that gets
the definition, whereas all others still try to reference the
incorrect name.  Oops.  Nevermind.  Nothing like a good testcase to
verify that a patch actually fixes a problem :-)

Here's the testcase I've just checked in.  I used g++.old-deja because
I don't know how to do multi-translation-unit tests with g++.dg.  Does
anyone?

I've filed a gnats bug report too.

Index: gcc/testsuite/g++.old-deja/g++.oliva/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* linkage1.C, linkage1-main.cc: New test.

Index: gcc/testsuite/g++.old-deja/g++.oliva/linkage1-main.cc
===================================================================
RCS file: gcc/testsuite/g++.old-deja/g++.oliva/linkage1-main.cc
diff -N gcc/testsuite/g++.old-deja/g++.oliva/linkage1-main.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gcc/testsuite/g++.old-deja/g++.oliva/linkage1-main.cc 6 Jul 2002 16:16:05 -0000
@@ -0,0 +1,13 @@
+// Copyright 2002 Free Software Foundation
+
+// Derived by Alexandre Oliva <aoliva@redhat.com> from code posted by
+// Mark Mitchell <mark@codesourcery.com>
+
+typedef struct {
+  void f();
+} S;
+
+int main() {
+  S s;
+  s.f();
+}
Index: gcc/testsuite/g++.old-deja/g++.oliva/linkage1.C
===================================================================
RCS file: gcc/testsuite/g++.old-deja/g++.oliva/linkage1.C
diff -N gcc/testsuite/g++.old-deja/g++.oliva/linkage1.C
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gcc/testsuite/g++.old-deja/g++.oliva/linkage1.C 6 Jul 2002 16:16:05 -0000
@@ -0,0 +1,21 @@
+// Copyright 2002 Free Software Foundation
+
+// Derived by Alexandre Oliva <aoliva@redhat.com> from code posted by
+// Mark Mitchell <mark@codesourcery.com>
+
+// Build don't run:
+
+// Additional sources: linkage1-main.cc
+
+// Verify that a member of a class is given global linkage when it's a
+// member of a function whose name is taken from a typedef, by
+// checking that another translation unit can call it.  We don't do
+// the right things on functions, but we do on data members.
+
+// excess errors test - XFAIL *-*-*
+
+typedef struct {
+  void f();
+} S;
+
+void S::f() {}
-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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