aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2005-11-03 01:25:13 +0000
committerMark Mitchell <mark@codesourcery.com>2005-11-03 01:25:13 +0000
commitaf5d3c27d8b87b49d7789245a300ac533abc044c (patch)
tree661d0838f488e6d552b82cd1954a06b88e0521ff /gcc/cp
parent3038cfe0633f65eb09482c5d65d3bfe535a07bf4 (diff)
PR c++/22434
* call.c (build_conditional_expr): Do bad conversions, if there's no other choice. PR c++/22434 * g++.dg/expr/cond8.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@106418 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/call.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8d2ab78a214..eb52015cab7 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2005-11-02 Mark Mitchell <mark@codesourcery.com>
+ PR c++/22434
+ * call.c (build_conditional_expr): Do bad conversions, if there's
+ no other choice.
+
PR c++/24560
* parser.c (cp_parser_postfix_dot_deref_expression): Improve error
message for use of overloaded functions on LHS of "." operator.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 77cbe2a5ae5..99b8bcbee15 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -3281,13 +3281,13 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3)
error ("operands to ?: have different types");
result = error_mark_node;
}
- else if (conv2 && !conv2->bad_p)
+ else if (conv2 && (!conv2->bad_p || !conv3))
{
arg2 = convert_like (conv2, arg2);
arg2 = convert_from_reference (arg2);
arg2_type = TREE_TYPE (arg2);
}
- else if (conv3 && !conv3->bad_p)
+ else if (conv3 && (!conv3->bad_p || !conv2))
{
arg3 = convert_like (conv3, arg3);
arg3 = convert_from_reference (arg3);