summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Stellard <tstellar@redhat.com>2018-06-04 15:49:27 +0000
committerTom Stellard <tstellar@redhat.com>2018-06-04 15:49:27 +0000
commitf3e10f8b0524afac09213ef973e2fecc6149fd88 (patch)
treeed2185931cc096bc29afad7ecaae3f67b129d1e6
parent742e3215bf9e9aa657d13201ccb138ab2d0090fa (diff)
Merging r333467:llvmorg-6.0.1-rc2
------------------------------------------------------------------------ r333467 | marshall | 2018-05-29 15:25:42 -0700 (Tue, 29 May 2018) | 1 line Fix embarrasing typo in uncaught_exceptions. Update tests to really test this. Thanks to Peter Klotz for calling my attention to this. ------------------------------------------------------------------------ llvm-svn: 333910
-rw-r--r--libcxx/src/support/runtime/exception_libcxxabi.ipp2
-rw-r--r--libcxx/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp50
2 files changed, 30 insertions, 22 deletions
diff --git a/libcxx/src/support/runtime/exception_libcxxabi.ipp b/libcxx/src/support/runtime/exception_libcxxabi.ipp
index c3dcf1ec591a..feefc5152891 100644
--- a/libcxx/src/support/runtime/exception_libcxxabi.ipp
+++ b/libcxx/src/support/runtime/exception_libcxxabi.ipp
@@ -18,7 +18,7 @@ bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; }
int uncaught_exceptions() _NOEXCEPT
{
-# if _LIBCPPABI_VERSION > 1101
+# if _LIBCPPABI_VERSION > 1001
return __cxa_uncaught_exceptions();
# else
return __cxa_uncaught_exception() ? 1 : 0;
diff --git a/libcxx/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp b/libcxx/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
index e35e7afa322a..0a63a47429a6 100644
--- a/libcxx/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
+++ b/libcxx/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
@@ -15,40 +15,48 @@
// XFAIL: availability=macosx10.9
// XFAIL: availability=macosx10.10
// XFAIL: availability=macosx10.11
+// XFAIL: with_system_cxx_lib=macosx10.12
+// XFAIL: with_system_cxx_lib=macosx10.13
// test uncaught_exceptions
#include <exception>
#include <cassert>
-struct A
-{
- ~A()
- {
- assert(std::uncaught_exceptions() > 0);
- }
-};
+struct Uncaught {
+ Uncaught(int depth) : d_(depth) {}
+ ~Uncaught() { assert(std::uncaught_exceptions() == d_); }
+ int d_;
+ };
-struct B
-{
- B()
- {
- // http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#475
- assert(std::uncaught_exceptions() == 0);
+struct Outer {
+ Outer(int depth) : d_(depth) {}
+ ~Outer() {
+ try {
+ assert(std::uncaught_exceptions() == d_);
+ Uncaught u(d_+1);
+ throw 2;
}
+ catch (int) {}
+ }
+ int d_;
};
-int main()
-{
- try
+int main () {
+ assert(std::uncaught_exceptions() == 0);
{
- A a;
- assert(std::uncaught_exceptions() == 0);
- throw B();
+ Outer o(0);
}
- catch (...)
+
+ assert(std::uncaught_exceptions() == 0);
{
- assert(std::uncaught_exception() == 0);
+ try {
+ Outer o(1);
+ throw 1;
+ }
+ catch (int) {
+ assert(std::uncaught_exceptions() == 0);
+ }
}
assert(std::uncaught_exceptions() == 0);
}