diff options
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r-- | gcc/cp/tree.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 7872dd29cf8..c59543768a8 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -142,6 +142,9 @@ lvalue_kind (const_tree ref) return clk_none; /* FALLTHRU */ case VAR_DECL: + if (DECL_HAS_VALUE_EXPR_P (ref)) + return lvalue_kind (DECL_VALUE_EXPR (CONST_CAST_TREE (ref))); + if (TREE_READONLY (ref) && ! TREE_STATIC (ref) && DECL_LANG_SPECIFIC (ref) && DECL_IN_AGGR_P (ref)) @@ -1012,6 +1015,13 @@ tree cp_build_reference_type (tree to_type, bool rval) { tree lvalue_ref, t; + + if (TREE_CODE (to_type) == REFERENCE_TYPE) + { + rval = rval && TYPE_REF_IS_RVALUE (to_type); + to_type = TREE_TYPE (to_type); + } + lvalue_ref = build_reference_type (to_type); if (!rval) return lvalue_ref; |