aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2003-03-05 18:03:44 -0500
committerJason Merrill <jason@gcc.gnu.org>2003-03-05 18:03:44 -0500
commitc965b169438a609791fa0b0922b8aea3adb37c4d (patch)
tree5118b85c7cd9201505f901dec701c5aa4091988c /gcc
parent98857de85a8f3f2ad43f463cac579b3b86f9e4b5 (diff)
downloadgcc-c965b169438a609791fa0b0922b8aea3adb37c4d.zip
gcc-c965b169438a609791fa0b0922b8aea3adb37c4d.tar.gz
gcc-c965b169438a609791fa0b0922b8aea3adb37c4d.tar.bz2
re PR c++/9440 (error message about "non-lvalue in unary '&'" when using ?: operator)
PR c++/9440 * call.c (build_conditional_expr): Use convert rather than an explicit NOP_EXPR. From-SVN: r63872
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/call.c10
2 files changed, 9 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d874ac0..5e04f44 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2003-03-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/9440
+ * call.c (build_conditional_expr): Use convert rather than an
+ explicit NOP_EXPR.
+
2003-03-02 Matt Austern <austern@apple.com>
* decl.c (cp_binding_level): Add static_decls varray member.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index d59a320..fe26866 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -3112,13 +3112,9 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3)
arg2 = convert_from_reference (arg2);
/* That may not quite have done the trick. If the two types
are cv-qualified variants of one another, we will have
- just used an IDENTITY_CONV. (There's no conversion from
- an lvalue of one class type to an lvalue of another type,
- even a cv-qualified variant, and we don't want to lose
- lvalue-ness here.) So, we manually add a NOP_EXPR here
- if necessary. */
+ just used an IDENTITY_CONV. */
if (!same_type_p (TREE_TYPE (arg2), arg3_type))
- arg2 = build1 (NOP_EXPR, arg3_type, arg2);
+ arg2 = convert (arg3_type, arg2);
arg2_type = TREE_TYPE (arg2);
}
else if (conv3 && !ICS_BAD_FLAG (conv3))
@@ -3126,7 +3122,7 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3)
arg3 = convert_like (conv3, arg3);
arg3 = convert_from_reference (arg3);
if (!same_type_p (TREE_TYPE (arg3), arg2_type))
- arg3 = build1 (NOP_EXPR, arg2_type, arg3);
+ arg3 = convert (arg2_type, arg3);
arg3_type = TREE_TYPE (arg3);
}
}