aboutsummaryrefslogtreecommitdiff
path: root/gcc/convert.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-07-01 00:04:36 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2009-07-01 00:04:36 +0200
commit5ccde5a06a28e4d1a2bed1db333f1876690c634c (patch)
tree22d4472aed1465f326e3cc594adf1560e23c69d9 /gcc/convert.c
parent085e05ac8f14906e0651546074d2056183055e35 (diff)
downloadgcc-5ccde5a06a28e4d1a2bed1db333f1876690c634c.zip
gcc-5ccde5a06a28e4d1a2bed1db333f1876690c634c.tar.gz
gcc-5ccde5a06a28e4d1a2bed1db333f1876690c634c.tar.bz2
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
Diffstat (limited to 'gcc/convert.c')
-rw-r--r--gcc/convert.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/convert.c b/gcc/convert.c
index 8245e16..706dc41 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -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;