summaryrefslogtreecommitdiff
path: root/gcc/cp/except.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-05 22:25:29 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-05 22:25:29 +0000
commit7deddfded2d013c07a639873a4c90bfed40fd03e (patch)
tree3df2a52207fec5bec55c28303aa57a8bd9b4e620 /gcc/cp/except.c
parentc79b54af83c8031caac515081fb7c56a127b90e3 (diff)
downloadgcc-7deddfded2d013c07a639873a4c90bfed40fd03e.tar.gz
2010-11-05 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 166377 2010-11-05 Basile Starynkevitch <basile@starynkevitch.net> MELT branch merged with trunk rev 166377 * gcc/Makefile.in (MELT_RAW_CFLAGS): removed LIBELFINC git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@166380 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/except.c')
-rw-r--r--gcc/cp/except.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index b9176647ba7..f02096ed122 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -648,7 +648,9 @@ build_throw (tree exp)
{
if (cfun)
current_function_returns_abnormally = 1;
- return build_min (THROW_EXPR, void_type_node, exp);
+ exp = build_min (THROW_EXPR, void_type_node, exp);
+ SET_EXPR_LOCATION (exp, input_location);
+ return exp;
}
if (exp == null_node)
@@ -834,6 +836,7 @@ build_throw (tree exp)
}
exp = build1 (THROW_EXPR, void_type_node, exp);
+ SET_EXPR_LOCATION (exp, input_location);
return exp;
}
@@ -1051,15 +1054,20 @@ check_noexcept_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
STRIP_NOPS (fn);
if (TREE_CODE (fn) == ADDR_EXPR)
+ fn = TREE_OPERAND (fn, 0);
+ if (TREE_CODE (fn) == FUNCTION_DECL)
{
/* We do use TREE_NOTHROW for ABI internals like __dynamic_cast,
and for C library functions known not to throw. */
- fn = TREE_OPERAND (fn, 0);
- if (TREE_CODE (fn) == FUNCTION_DECL
- && DECL_EXTERN_C_P (fn)
+ if (DECL_EXTERN_C_P (fn)
&& (DECL_ARTIFICIAL (fn)
|| nothrow_libfn_p (fn)))
return TREE_NOTHROW (fn) ? NULL_TREE : fn;
+ /* A call to a constexpr function is noexcept if the call
+ is a constant expression. */
+ if (DECL_DECLARED_CONSTEXPR_P (fn)
+ && is_sub_constant_expr (t))
+ return NULL_TREE;
}
if (!TYPE_NOTHROW_P (type))
return fn;
@@ -1192,9 +1200,15 @@ type_throw_all_p (const_tree type)
tree
build_noexcept_spec (tree expr, int complain)
{
- expr = perform_implicit_conversion_flags (boolean_type_node, expr,
- complain,
- LOOKUP_NORMAL);
+ /* This isn't part of the signature, so don't bother trying to evaluate
+ it until instantiation. */
+ if (!processing_template_decl)
+ {
+ expr = cxx_constant_value (expr);
+ expr = perform_implicit_conversion_flags (boolean_type_node, expr,
+ complain,
+ LOOKUP_NORMAL);
+ }
if (expr == boolean_true_node)
return noexcept_true_spec;
else if (expr == boolean_false_node)