<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:david.majnemer@gmail.com" title="David Majnemer <david.majnemer@gmail.com>"> <span class="fn">David Majnemer</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - [ms][EH] Clang cannot find appropriate catch statement for a throw"
href="https://llvm.org/bugs/show_bug.cgi?id=26787">bug 26787</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>david.majnemer@gmail.com
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - [ms][EH] Clang cannot find appropriate catch statement for a throw"
href="https://llvm.org/bugs/show_bug.cgi?id=26787#c2">Comment # 2</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - [ms][EH] Clang cannot find appropriate catch statement for a throw"
href="https://llvm.org/bugs/show_bug.cgi?id=26787">bug 26787</a>
from <span class="vcard"><a class="email" href="mailto:david.majnemer@gmail.com" title="David Majnemer <david.majnemer@gmail.com>"> <span class="fn">David Majnemer</span></a>
</span></b>
<pre>This is not a bug.
Clang uses C++11 rules when targeting compatibility with MSVC 2013. MSVC 2013
is buggy and does not follow all the rules. You will get the same behavior for
clang on linux if you supply -std=c++11.
Furthermore, MSVC 2015 has identical behavior to clang:
D:\>type t.cpp
#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;
}
D:\>cl -w -O2 -EHs t.cpp && t
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23725 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
t.cpp
Microsoft (R) Incremental Linker Version 14.00.23725.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:t.exe
t.obj
$ ./t.exe
B destructed
$ echo $?
3</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>