[llvm-bugs] [Bug 28904] New: -Wexceptions fails to emit for "will be caught by earlier handler" when using aliases

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 8 08:25:13 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28904

            Bug ID: 28904
           Summary: -Wexceptions fails to emit for "will be caught by
                    earlier handler" when using aliases
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bloerwald at googlemail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16911
  --> https://llvm.org/bugs/attachment.cgi?id=16911&action=edit
reproducing source as file

-Wexceptions can detect duplicate `catch`es (e.g. catching int twice), but
fails to do so when using aliasing and aliased types mixed:

$ cat tmp.cpp
    typedef int int_;
    int main (int, char**) {
      try {
        throw 1;
      }
      catch (FIRST) {
        return __LINE__;
      }
      catch (SECOND) {
        return __LINE__;
      }
      return __LINE__;
    }

$ for first in int int_; do \
    for second in int int_; do \
      echo $first $second \
        $(clang++ -Weverything tmp.cpp -DFIRST=$first -DSECOND=$second 2>&1 |
wc -l) \
        $(./a.out; echo $?); \
  done; done

    int int 13 7
    int int_ 0 7
    int_ int 0 7
    int_ int_ 13 7

Only the case with the same name is detected (first and last). Note that all
combinations correctly call the first `catch` (line 7).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160808/c8703f36/attachment.html>


More information about the llvm-bugs mailing list