https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90992

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This inconsistency is because the warning function uses one location, and the
following warning_at uses a different location:

static void
maybe_noexcept_warning (tree fn)
{
  if (TREE_NOTHROW (fn))
    {
      warning (OPT_Wnoexcept, "noexcept-expression evaluates to %<false%> "
               "because of a call to %qD", fn);
      warning_at (DECL_SOURCE_LOCATION (fn), OPT_Wnoexcept,
                  "but %qD does not throw; perhaps "
                  "it should be declared %<noexcept%>", fn);
    }
}

I think we either want to suppress the second warning if the first one isn't
printed, or don't suppress the first one if DECL_SOURCE_LOCATION (fn) is not in
a system header.

Reply via email to