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
This commit is contained in:
Mark Mitchell 2005-11-03 01:25:13 +00:00 committed by Mark Mitchell
parent 85ffcaf292
commit 3a0588c4e0
4 changed files with 22 additions and 2 deletions

View File

@ -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.

View File

@ -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);

View File

@ -1,5 +1,8 @@
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.

View File

@ -0,0 +1,13 @@
// 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" }
}