re PR c++/40566 (rejects promoted throw)
PR c++/40566 * convert.c (convert_to_integer) <case COND_EXPR>: Don't convert to type arguments that have void type. * g++.dg/parse/cond5.C: New test. From-SVN: r149121
This commit is contained in:
parent
085e05ac8f
commit
5ccde5a06a
4 changed files with 28 additions and 3 deletions
|
@ -1,5 +1,9 @@
|
|||
2009-06-30 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/40566
|
||||
* convert.c (convert_to_integer) <case COND_EXPR>: Don't convert
|
||||
to type arguments that have void type.
|
||||
|
||||
PR debug/40573
|
||||
* dwarf2out.c (gen_formal_parameter_die): Call
|
||||
equate_decl_number_to_die if node is different from origin.
|
||||
|
|
|
@ -772,10 +772,16 @@ convert_to_integer (tree type, tree expr)
|
|||
|
||||
case COND_EXPR:
|
||||
/* It is sometimes worthwhile to push the narrowing down through
|
||||
the conditional and never loses. */
|
||||
the conditional and never loses. A COND_EXPR may have a throw
|
||||
as one operand, which then has void type. Just leave void
|
||||
operands as they are. */
|
||||
return fold_build3 (COND_EXPR, type, TREE_OPERAND (expr, 0),
|
||||
convert (type, TREE_OPERAND (expr, 1)),
|
||||
convert (type, TREE_OPERAND (expr, 2)));
|
||||
VOID_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 1)))
|
||||
? TREE_OPERAND (expr, 1)
|
||||
: convert (type, TREE_OPERAND (expr, 1)),
|
||||
VOID_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 2)))
|
||||
? TREE_OPERAND (expr, 2)
|
||||
: convert (type, TREE_OPERAND (expr, 2)));
|
||||
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2009-06-30 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/40566
|
||||
* g++.dg/parse/cond5.C: New test.
|
||||
|
||||
2009-06-30 Nathan Froyd <froydnj@codesourcery.com>
|
||||
|
||||
* gcc.dg/tree-ssa/gen-vect-25.c (n): New variable.
|
||||
|
|
10
gcc/testsuite/g++.dg/parse/cond5.C
Normal file
10
gcc/testsuite/g++.dg/parse/cond5.C
Normal file
|
@ -0,0 +1,10 @@
|
|||
// PR c++/40566
|
||||
|
||||
void
|
||||
f (int x, int y)
|
||||
{
|
||||
int c = x ? 23 : throw "bla";
|
||||
short d = y ? throw "bla" : 23;
|
||||
char e = x ? 23 : throw "bla";
|
||||
long f = x ? 23 : throw "bla";
|
||||
}
|
Loading…
Add table
Reference in a new issue