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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to