]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/54883 (Name mangling of types in an unnamed namespace)
authorJason Merrill <jason@redhat.com>
Tue, 11 Dec 2012 22:46:37 +0000 (17:46 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 11 Dec 2012 22:46:37 +0000 (17:46 -0500)
PR c++/54883
* decl2.c (min_vis_r): Handle anon visibility for enums.

From-SVN: r194432

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

index 2a607b896c26cc9cb38a490b17d079471d8ae2a6..f3048c182b77fa334a824c4c8fa8f0146e95abf7 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-06  Jason Merrill  <jason@redhat.com>
 
        PR c++/55249
index 51f23f47c66a53d3a5a7e7c4a2365389ade09cc2..4c55f4fc381f16339cd3616c034815007517f8f4 100644 (file)
@@ -1914,16 +1914,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" } }