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: unassignedclangb...@nondot.org
          Reporter: bloerw...@googlemail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to