* tree.c (build_aggr_init_expr): Propagate TREE_NOTHROW.
* semantics.c (simplify_aggr_init_expr): Likewise.
* typeck.c (merge_types): Call merge_exception_specifiers.
* decl.c (duplicate_decls): Check DECL_SOURCE_LOCATION rather than
DECL_ANTICIPATED for preferring new type.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160296
138bc75d-0d04-0410-961f-
82ee72b054a4
+2010-06-04 Jason Merrill <jason@redhat.com>
+
+ * call.c (build_conditional_expr): Never fold in unevaluated context.
+ * tree.c (build_aggr_init_expr): Propagate TREE_NOTHROW.
+ * semantics.c (simplify_aggr_init_expr): Likewise.
+ * typeck.c (merge_types): Call merge_exception_specifiers.
+ * decl.c (duplicate_decls): Check DECL_SOURCE_LOCATION rather than
+ DECL_ANTICIPATED for preferring new type.
+
2010-06-04 Joseph Myers <joseph@codesourcery.com>
* g++spec.c (lang_specific_driver): Use GCC-specific formats in
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;
}
valid_operands:
- result_save = build3 (COND_EXPR, result_type, arg1, arg2, arg3);
- result = fold_if_not_in_template (result_save);
-
- if (cp_unevaluated_operand && TREE_CODE (result) == CALL_EXPR)
- /* Avoid folding to a CALL_EXPR within decltype (c++/42013). */
- result = result_save;
+ result = build3 (COND_EXPR, result_type, arg1, arg2, arg3);
+ if (!cp_unevaluated_operand)
+ /* Avoid folding within decltype (c++/42013) and noexcept. */
+ result = fold_if_not_in_template (result);
/* We can't use result_type below, as fold might have returned a
throw_expr. */
/* Even if the types match, prefer the new declarations type for
built-ins which have not been explicitly declared, for
exception lists, etc... */
- else if (DECL_ANTICIPATED (olddecl))
+ else if (DECL_SOURCE_LOCATION (olddecl) == BUILTINS_LOCATION)
{
tree type = TREE_TYPE (newdecl);
tree attribs = (*targetm.merge_type_attributes)
fn,
aggr_init_expr_nargs (aggr_init_expr),
AGGR_INIT_EXPR_ARGP (aggr_init_expr));
+ TREE_NOTHROW (call_expr) = TREE_NOTHROW (aggr_init_expr);
if (style == ctor)
{
AGGR_INIT_EXPR_ARGP (init));
TREE_SIDE_EFFECTS (rval) = 1;
AGGR_INIT_VIA_CTOR_P (rval) = is_ctor;
+ TREE_NOTHROW (rval) = TREE_NOTHROW (init);
}
else
rval = init;
/* Simple way if one arg fails to specify argument types. */
if (p1 == NULL_TREE || TREE_VALUE (p1) == void_type_node)
- {
- parms = p2;
- raises = TYPE_RAISES_EXCEPTIONS (t2);
- }
+ parms = p2;
else if (p2 == NULL_TREE || TREE_VALUE (p2) == void_type_node)
- {
- parms = p1;
- raises = TYPE_RAISES_EXCEPTIONS (t1);
- }
+ parms = p1;
else
- {
- parms = commonparms (p1, p2);
- /* In cases where we're merging a real declaration with a
- built-in declaration, t1 is the real one. */
- raises = TYPE_RAISES_EXCEPTIONS (t1);
- }
+ parms = commonparms (p1, p2);
rval = build_function_type (valtype, parms);
gcc_assert (type_memfn_quals (t1) == type_memfn_quals (t2));
rval = apply_memfn_quals (rval, type_memfn_quals (t1));
+ raises = merge_exception_specifiers (TYPE_RAISES_EXCEPTIONS (t1),
+ TYPE_RAISES_EXCEPTIONS (t2));
t1 = build_exception_variant (rval, raises);
break;
}
/* Get this value the long way, since TYPE_METHOD_BASETYPE
is just the main variant of this. */
tree basetype = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t2)));
- tree raises = TYPE_RAISES_EXCEPTIONS (t1);
+ tree raises = merge_exception_specifiers (TYPE_RAISES_EXCEPTIONS (t1),
+ TYPE_RAISES_EXCEPTIONS (t2));
tree t3;
/* If this was a member function type, get back to the