[llvm-bugs] [Bug 26787] New: [ms][EH] Clang cannot find appropriate catch statement for a throw

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 1 04:38:31 PST 2016


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

            Bug ID: 26787
           Summary: [ms][EH] Clang cannot find appropriate catch statement
                    for a throw
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrey.kuleshov at intel.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

!- Clang incorrectly works with EH on Windows and cannot find appropriate catch
statement for a throw function, all other compilers work correctly.
Moreover clang on Linux works correctly as well. This problem can be related to
incorrect work of function-try-block -!

=====Environment===========
OS: Windows 
Lang: c++


=====Small Reproducer======
#include <stdio.h>
struct A {
    ~A () { throw 1; }
};
struct B : public A {
    ~B()
    try { printf("B destructed\n"); }
    catch(int j) { printf("Caught %d in ~B\n", j); }
};
int main()
{
    try { B b; }
    catch (int j) {}
    return 0;
}

$ clang test.cpp -o out.exe
$./out.exe


=========Behavior==========
>>> clang on Win:
  B destructed 
  $ echo $?
      9
>>> clang on Lin, gcc, MSVC, Intel icc:
  B destructed
  Caught 1 in ~B
      0

Andrey Kuleshov
=================
Software Engineer
Intel Compiler Team

-- 
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/20160301/f6772893/attachment.html>


More information about the llvm-bugs mailing list