Commit 3a0588c4 by Mark Mitchell Committed by Mark Mitchell

re PR c++/22434 (ICE in simplify_{,gen_}subreg)

	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.

From-SVN: r106418
parent 85ffcaf2
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.
......
......@@ -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);
......
2005-11-02 Mark Mitchell <mark@codesourcery.com>
PR c++/22434
* g++.dg/expr/cond8.C: New test.
PR c++/24560
* g++.dg/parse/dot1.C: New test.
// PR c++/22434
// { dg-options "" }
struct A
{
A(void*);
~A();
};
void foo(const int i, bool b)
{
b ? A(0) : i; // { dg-error "conversion|initializing" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment