From 5ccde5a06a28e4d1a2bed1db333f1876690c634c Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 1 Jul 2009 00:04:36 +0200 Subject: re PR c++/40566 (rejects promoted throw) PR c++/40566 * convert.c (convert_to_integer) : Don't convert to type arguments that have void type. * g++.dg/parse/cond5.C: New test. From-SVN: r149121 --- gcc/convert.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'gcc/convert.c') 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; -- cgit v1.1