OSDN Git Service

PR c++/54883
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Dec 2012 22:46:22 +0000 (22:46 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Dec 2012 22:46:22 +0000 (22:46 +0000)
* decl2.c (min_vis_r): Handle anon visibility for enums.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@194431 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/g++.dg/abi/anon1.C [new file with mode: 0644]

index e7459e6..678c55d 100644 (file)
@@ -1,3 +1,8 @@
+2012-12-11  Jason Merrill  <jason@redhat.com>
+
+       PR c++/54883
+       * decl2.c (min_vis_r): Handle anon visibility for enums.
+
 2012-12-11  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/55643
index 36e74c7..f23062b 100644 (file)
@@ -1929,16 +1929,15 @@ min_vis_r (tree *tp, int *walk_subtrees, void *data)
     {
       *walk_subtrees = 0;
     }
-  else if (CLASS_TYPE_P (*tp))
+  else if (TAGGED_TYPE_P (*tp)
+          && !TREE_PUBLIC (TYPE_MAIN_DECL (*tp)))
     {
-      if (!TREE_PUBLIC (TYPE_MAIN_DECL (*tp)))
-       {
-         *vis_p = VISIBILITY_ANON;
-         return *tp;
-       }
-      else if (CLASSTYPE_VISIBILITY (*tp) > *vis_p)
-       *vis_p = CLASSTYPE_VISIBILITY (*tp);
+      *vis_p = VISIBILITY_ANON;
+      return *tp;
     }
+  else if (CLASS_TYPE_P (*tp)
+          && CLASSTYPE_VISIBILITY (*tp) > *vis_p)
+    *vis_p = CLASSTYPE_VISIBILITY (*tp);
   return NULL;
 }
 
diff --git a/gcc/testsuite/g++.dg/abi/anon1.C b/gcc/testsuite/g++.dg/abi/anon1.C
new file mode 100644 (file)
index 0000000..c45917a
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c++/54883
+
+namespace { enum E { E1 }; } void f(E e) { }
+
+// { dg-final { scan-assembler-not "globl" } }