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

            Bug ID: 81660
           Summary: Learn GCC -Wexceptions
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: mpolacek at gcc dot gnu.org
  Target Milestone: ---

Clang can show some diagnostics about:

$ cat exception.cpp
void
a (int b)
{
  if (b)
    throw;
  try
    {
      a (3);
    }
  catch (int)
    {
    }
  catch (int)
    {
    }
}

$ clang++ exception.cpp
exception.cpp:13:10: warning: exception of type 'int' will be caught by earlier
handler [-Wexceptions]
  catch (int)
         ^
exception.cpp:10:10: note: for type 'int'
  catch (int)
         ^
Maybe we can also do similar warning?

Reply via email to