forked from OSchip/llvm-project
Add EH test case checking that handlers in noexcept functions can still unwind
llvm-svn: 209944
This commit is contained in:
parent
75fd1b5f51
commit
20f6f45c5b
|
|
@ -0,0 +1,34 @@
|
||||||
|
//===---------------------- catch_in_noexcept.cpp--------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
struct A {};
|
||||||
|
|
||||||
|
// Despite being marked as noexcept, this function must have an EHT entry that
|
||||||
|
// is not 'cantunwind', so that the unwinder can correctly deal with the throw.
|
||||||
|
void f1() noexcept
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
A a;
|
||||||
|
throw a;
|
||||||
|
assert(false);
|
||||||
|
} catch (...) {
|
||||||
|
assert(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
f1();
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue