re PR c++/54883 (Name mangling of types in an unnamed namespace)

PR c++/54883
	* decl2.c (min_vis_r): Handle anon visibility for enums.

From-SVN: r194431
This commit is contained in:
Jason Merrill 2012-12-11 17:46:22 -05:00 committed by Jason Merrill
parent d20129ac68
commit 3e98a627cc
3 changed files with 17 additions and 8 deletions

View 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

View 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;
}

View File

@ -0,0 +1,5 @@
// PR c++/54883
namespace { enum E { E1 }; } void f(E e) { }
// { dg-final { scan-assembler-not "globl" } }