aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl2.cc')
-rw-r--r--gcc/cp/decl2.cc22
1 files changed, 17 insertions, 5 deletions
diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc
index 4a9fb1c..a3149f2 100644
--- a/gcc/cp/decl2.cc
+++ b/gcc/cp/decl2.cc
@@ -2843,16 +2843,28 @@ min_vis_expr_r (tree *tp, int */*walk_subtrees*/, void *data)
tpvis = type_visibility (TREE_TYPE (t));
break;
+ case ADDR_EXPR:
+ t = TREE_OPERAND (t, 0);
+ if (VAR_P (t))
+ /* If a variable has its address taken, the lvalue-rvalue conversion is
+ not applied, so skip that case. */
+ goto addressable;
+ break;
+
case VAR_DECL:
case FUNCTION_DECL:
if (decl_constant_var_p (t))
/* The ODR allows definitions in different TUs to refer to distinct
constant variables with internal or no linkage, so such a reference
- shouldn't affect visibility (PR110323). FIXME but only if the
- lvalue-rvalue conversion is applied. We still want to restrict
- visibility according to the type of the declaration however. */
- tpvis = type_visibility (TREE_TYPE (t));
- else if (! TREE_PUBLIC (t))
+ shouldn't affect visibility if the lvalue-rvalue conversion is
+ applied (PR110323). We still want to restrict visibility according
+ to the type of the declaration however. */
+ {
+ tpvis = type_visibility (TREE_TYPE (t));
+ break;
+ }
+ addressable:
+ if (! TREE_PUBLIC (t))
tpvis = VISIBILITY_ANON;
else
tpvis = DECL_VISIBILITY (t);