]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/65879 (Bogus linkage errors for member class of anonymous class)
authorJason Merrill <jason@redhat.com>
Tue, 23 Jun 2015 14:29:51 +0000 (10:29 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 23 Jun 2015 14:29:51 +0000 (10:29 -0400)
PR c++/65879
* tree.c (no_linkage_check): Skip the 'this' pointer.

From-SVN: r224847

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/g++.dg/other/anon7.C [new file with mode: 0644]

index 599471245e2485caaac11da39212714a3a798412..94ab7dd88a5efda642746164e02014653c76507b 100644 (file)
@@ -1,3 +1,8 @@
+2015-06-23  Jason Merrill  <jason@redhat.com>
+
+       PR c++/65879
+       * tree.c (no_linkage_check): Skip the 'this' pointer.
+
 2015-06-03  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
index 2820ba0f9769914665b72cbc8c4f9d6952081188..11c352143d45c91423020c5400f539ed52203735 100644 (file)
@@ -2193,14 +2193,14 @@ no_linkage_check (tree t, bool relaxed_p)
       return no_linkage_check (TYPE_PTRMEM_CLASS_TYPE (t), relaxed_p);
 
     case METHOD_TYPE:
-      r = no_linkage_check (TYPE_METHOD_BASETYPE (t), relaxed_p);
-      if (r)
-       return r;
-      /* Fall through.  */
     case FUNCTION_TYPE:
       {
-       tree parm;
-       for (parm = TYPE_ARG_TYPES (t);
+       tree parm = TYPE_ARG_TYPES (t);
+       if (TREE_CODE (t) == METHOD_TYPE)
+         /* The 'this' pointer isn't interesting; a method has the same
+            linkage (or lack thereof) as its enclosing class.  */
+         parm = TREE_CHAIN (parm);
+       for (;
             parm && parm != void_list_node;
             parm = TREE_CHAIN (parm))
          {
diff --git a/gcc/testsuite/g++.dg/other/anon7.C b/gcc/testsuite/g++.dg/other/anon7.C
new file mode 100644 (file)
index 0000000..12c1ab2
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/65879
+
+static struct
+{
+  void f();
+  struct Inner
+  {
+    void g();
+  };
+} x;