re PR c++/42013 (cv-qualification of conditional expression type depending on the value of its first expression?!?)
PR c++/42013 * call.c (build_conditional_expr): Check specifically for folding to CALL_EXPR rather than TREE_SIDE_EFFECTS. From-SVN: r154129
This commit is contained in:
parent
c8f59bc81c
commit
d6c057abd6
@ -1,3 +1,9 @@
|
||||
2009-11-12 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/42013
|
||||
* call.c (build_conditional_expr): Check specifically for folding
|
||||
to CALL_EXPR rather than TREE_SIDE_EFFECTS.
|
||||
|
||||
2009-11-12 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* typeck.c (cv_qualified_p): New fn.
|
||||
|
@ -3605,6 +3605,7 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3,
|
||||
tree arg2_type;
|
||||
tree arg3_type;
|
||||
tree result = NULL_TREE;
|
||||
tree result_save;
|
||||
tree result_type = NULL_TREE;
|
||||
bool lvalue_p = true;
|
||||
struct z_candidate *candidates = 0;
|
||||
@ -3991,12 +3992,12 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3,
|
||||
}
|
||||
|
||||
valid_operands:
|
||||
result = build3 (COND_EXPR, result_type, arg1, arg2, arg3);
|
||||
result_save = build3 (COND_EXPR, result_type, arg1, arg2, arg3);
|
||||
result = fold_if_not_in_template (result_save);
|
||||
|
||||
if (cp_unevaluated_operand && TREE_SIDE_EFFECTS (result))
|
||||
/* Avoid folding a ?: of two calls within decltype (c++/42013). */;
|
||||
else
|
||||
result = fold_if_not_in_template (result);
|
||||
if (cp_unevaluated_operand && TREE_CODE (result) == CALL_EXPR)
|
||||
/* Avoid folding to a CALL_EXPR within decltype (c++/42013). */
|
||||
result = result_save;
|
||||
|
||||
/* We can't use result_type below, as fold might have returned a
|
||||
throw_expr. */
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
template<typename _Tp>
|
||||
_Tp
|
||||
declval();
|
||||
__attribute ((const)) declval();
|
||||
|
||||
template<typename _Tp, typename _Up>
|
||||
struct common_type
|
||||
|
Loading…
Reference in New Issue
Block a user