summaryrefslogtreecommitdiff
path: root/gcc/c-typeck.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@gcc.gnu.org>2009-09-27 15:27:08 +0000
committerAndreas Schwab <schwab@gcc.gnu.org>2009-09-27 15:27:08 +0000
commitafbd0665815715ff285dba5143ecb49d4d27990f (patch)
treec7e4b6907c602b90a4229832311fc15b051f3545 /gcc/c-typeck.c
parent88febe351918f2cb70edd3527febf3e06f588089 (diff)
downloadgcc-afbd0665815715ff285dba5143ecb49d4d27990f.tar.gz
re PR c/41476 (__typeof__ expands to const type for function types)
PR c/41476 * c-typeck.c (build_conditional_expr): Use the readonly and volatile flags of the operand types, not of the operands itself. testsuite/: * gcc.dg/cond-constqual-1.c: New test. From-SVN: r152220
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r--gcc/c-typeck.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 1b2b8585823..4c55e587de3 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -4033,12 +4033,12 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
/* Merge const and volatile flags of the incoming types. */
result_type
= build_type_variant (result_type,
- TREE_READONLY (op1) || TREE_READONLY (op2),
- TREE_THIS_VOLATILE (op1) || TREE_THIS_VOLATILE (op2));
+ TYPE_READONLY (type1) || TYPE_READONLY (type2),
+ TYPE_VOLATILE (type1) || TYPE_VOLATILE (type2));
- if (result_type != TREE_TYPE (op1))
+ if (result_type != type1)
op1 = convert_and_check (result_type, op1);
- if (result_type != TREE_TYPE (op2))
+ if (result_type != type2)
op2 = convert_and_check (result_type, op2);
if (ifexp_bcp && ifexp == truthvalue_true_node)