From dca61c7e6194d0f2942ced148e17bb05f688124c Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Tue, 11 Jun 2013 16:23:24 +0200 Subject: [PATCH] re PR regression/57551 (g++.dg/ext/visibility/anon6.C scan-assembler 1BIiE1cE) PR c++/57551 * g++.dg/ext/visibility/anon6.C: Update testcase. * cp/pt.c (mark_decl_instantiated): Do not export explicit instantiations of anonymous namespace templates. From-SVN: r199956 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/ext/visibility/anon6.C | 4 +++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 02451538a98..144f1fc4edb 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-06-11 Jan Hubicka + + PR c++/57551 + * cp/pt.c (mark_decl_instantiated): Do not export explicit instantiations + of anonymous namespace templates. + 2013-06-10 Jason Merrill * name-lookup.c (add_decl_to_level): Add decls in an anonymous diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 5d83cc6c967..3602fcd2dd8 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -17399,6 +17399,13 @@ mark_decl_instantiated (tree result, int extern_p) if (TREE_ASM_WRITTEN (result)) return; + /* For anonymous namespace we don't need to do anything. */ + if (decl_anon_ns_mem_p (result)) + { + gcc_assert (!TREE_PUBLIC (result)); + return; + } + if (TREE_CODE (result) != FUNCTION_DECL) /* The TREE_PUBLIC flag for function declarations will have been set correctly by tsubst. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 611404da34f..f3bcb95c36a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-06-11 Jan Hubicka + + PR c++/57551 + * g++.dg/ext/visibility/anon6.C: Update testcase. + 2013-06-10 Balaji V. Iyer PR c/57563 diff --git a/gcc/testsuite/g++.dg/ext/visibility/anon6.C b/gcc/testsuite/g++.dg/ext/visibility/anon6.C index 951de4964e4..c0aa7357793 100644 --- a/gcc/testsuite/g++.dg/ext/visibility/anon6.C +++ b/gcc/testsuite/g++.dg/ext/visibility/anon6.C @@ -1,6 +1,8 @@ // PR c++/33094 // { dg-final { scan-assembler "1BIiE1cE" } } // { dg-final { scan-assembler-not "globl.*1BIiE1cE" } } +// { dg-final { scan-assembler-not "comdat" } } +// { dg-final { scan-assembler-not "weak" } } // { dg-final { scan-assembler-not "1CIiE1cE" } } // Test that B::c is emitted as an internal symbol, and C::c is @@ -18,7 +20,7 @@ namespace template class B { - static const T c = 0; + __attribute__ ((__used__)) static const T c = 0; }; template const T B::c; -- 2.30.2