diff options
author | Jason Merrill <jason@redhat.com> | 2015-02-25 16:46:29 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2015-02-25 16:46:29 -0500 |
commit | 2b8f9c8f36033b7ed3a2b89d61db7f1a3fdb0a42 (patch) | |
tree | 592147f21b784a100deceaa9bf9f077ed9b31910 /gcc/cp/decl2.c | |
parent | 76fabbf42df41d1275c71a4ff159b8b53147c6f4 (diff) | |
download | gcc-2b8f9c8f36033b7ed3a2b89d61db7f1a3fdb0a42.zip gcc-2b8f9c8f36033b7ed3a2b89d61db7f1a3fdb0a42.tar.gz gcc-2b8f9c8f36033b7ed3a2b89d61db7f1a3fdb0a42.tar.bz2 |
re PR c++/65209 (Broken code with global static variables, invalid pointer when freeing global variables)
PR c++/65209
* decl2.c (constrain_visibility) [VISIBILITY_ANON]: Clear
DECL_COMDAT.
(constrain_visibility_for_template): Handle reference arguments.
From-SVN: r220991
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r-- | gcc/cp/decl2.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index a7bc08f..a4a5ebf 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2175,6 +2175,7 @@ constrain_visibility (tree decl, int visibility, bool tmpl) TREE_PUBLIC (decl) = 0; DECL_WEAK (decl) = 0; DECL_COMMON (decl) = 0; + DECL_COMDAT (decl) = false; if (TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == VAR_DECL) { @@ -2215,9 +2216,12 @@ constrain_visibility_for_template (tree decl, tree targs) tree arg = TREE_VEC_ELT (args, i-1); if (TYPE_P (arg)) vis = type_visibility (arg); - else if (TREE_TYPE (arg) && POINTER_TYPE_P (TREE_TYPE (arg))) + else { - STRIP_NOPS (arg); + if (REFERENCE_REF_P (arg)) + arg = TREE_OPERAND (arg, 0); + if (TREE_TYPE (arg)) + STRIP_NOPS (arg); if (TREE_CODE (arg) == ADDR_EXPR) arg = TREE_OPERAND (arg, 0); if (VAR_OR_FUNCTION_DECL_P (arg)) |