summaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authorMike Stump <mrs@gcc.gnu.org>1996-08-26 20:32:48 +0000
committerMike Stump <mrs@gcc.gnu.org>1996-08-26 20:32:48 +0000
commitd11ad92ebed6c4feed7ef1001b18ed707395d074 (patch)
treebab1c93d6daf3259c2fe093e7eea00d62511ec1f /gcc/cp/tree.c
parent9d8757d442d3690c6f12e7378bdb2c6aeda3ccfb (diff)
downloadgcc-d11ad92ebed6c4feed7ef1001b18ed707395d074.tar.gz
88 Cygnus<->FSF merge
From-SVN: r12674
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 4551177ab3c..a09d5cd8ac8 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2105,3 +2105,31 @@ make_temp_vec (len)
pop_obstacks ();
return node;
}
+
+/* The type of ARG when used as an lvalue. */
+
+tree
+lvalue_type (arg)
+ tree arg;
+{
+ return cp_build_type_variant
+ (TREE_TYPE (arg), TREE_READONLY (arg), TREE_THIS_VOLATILE (arg));
+}
+
+/* The type of ARG for printing error messages; denote lvalues with
+ reference types. */
+
+tree
+error_type (arg)
+ tree arg;
+{
+ tree type = TREE_TYPE (arg);
+ if (TREE_CODE (type) == ARRAY_TYPE)
+ ;
+ else if (real_lvalue_p (arg))
+ type = build_reference_type (lvalue_type (arg));
+ else if (IS_AGGR_TYPE (type))
+ type = lvalue_type (arg);
+
+ return type;
+}