summaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 74af7e842c..82ef6425de 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3109,6 +3109,8 @@ process_outer_var_ref (tree decl, tsubst_flags_t complain)
if (cp_unevaluated_operand)
/* It's not a use (3.2) if we're in an unevaluated context. */
return decl;
+ if (decl == error_mark_node)
+ return decl;
tree context = DECL_CONTEXT (decl);
tree containing_function = current_function_decl;
@@ -3133,7 +3135,11 @@ process_outer_var_ref (tree decl, tsubst_flags_t complain)
form, so wait until instantiation time. */
return decl;
else if (decl_constant_var_p (decl))
- return scalar_constant_value (decl);
+ {
+ tree t = maybe_constant_value (convert_from_reference (decl));
+ if (TREE_CONSTANT (t))
+ return t;
+ }
}
if (parsing_nsdmi ())