diff options
Diffstat (limited to 'gcc/cp/except.cc')
-rw-r--r-- | gcc/cp/except.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/cp/except.cc b/gcc/cp/except.cc index a7f35e4..2c1ef4c 100644 --- a/gcc/cp/except.cc +++ b/gcc/cp/except.cc @@ -1218,6 +1218,18 @@ expr_noexcept_p (tree expr, tsubst_flags_t complain) return true; } +/* Explain why EXPR is not noexcept. */ + +void explain_not_noexcept (tree expr) +{ + tree fn = cp_walk_tree_without_duplicates (&expr, check_noexcept_r, 0); + gcc_assert (fn); + if (DECL_P (fn)) + inform (DECL_SOURCE_LOCATION (fn), "%qD is not %<noexcept%>", fn); + else + inform (location_of (fn), "%qT is not %<noexcept%>", TREE_TYPE (fn)); +} + /* Return true iff SPEC is throw() or noexcept(true). */ bool |