Skip to content

Commit

Permalink
Protect smart-pointer tests under no exceptions
Browse files Browse the repository at this point in the history
Skip tests that expect an exception be thrown under no-exceptions.

Differential Revision: https://reviews.llvm.org/D26457

llvm-svn: 286809
  • Loading branch information
Roger Ferrer Ibanez committed Nov 14, 2016
1 parent bda7276 commit 4a152f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//

// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: sanitizer-new-delete

// <memory>
Expand Down Expand Up @@ -63,6 +62,7 @@ int main()
assert(p.get() == raw_ptr);
assert(ptr.get() == 0);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
assert(A::count == 0);
{
std::unique_ptr<A> ptr(new A);
Expand All @@ -86,6 +86,7 @@ int main()
#endif
}
}
#endif
assert(A::count == 0);
{ // LWG 2399
fn(std::unique_ptr<int>(new int));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//

// XFAIL: libcpp-no-exceptions
// <memory>

// shared_ptr
Expand All @@ -17,6 +16,8 @@
#include <memory>
#include <cassert>

#include "test_macros.h"

struct B
{
static int count;
Expand All @@ -42,6 +43,7 @@ int A::count = 0;

int main()
{
#ifndef TEST_HAS_NO_EXCEPTIONS
{
std::weak_ptr<A> wp;
try
Expand All @@ -54,6 +56,7 @@ int main()
}
assert(A::count == 0);
}
#endif
{
std::shared_ptr<A> sp0(new A);
std::weak_ptr<A> wp(sp0);
Expand All @@ -63,6 +66,7 @@ int main()
assert(A::count == 1);
}
assert(A::count == 0);
#ifndef TEST_HAS_NO_EXCEPTIONS
{
std::shared_ptr<A> sp0(new A);
std::weak_ptr<A> wp(sp0);
Expand All @@ -77,4 +81,5 @@ int main()
}
}
assert(A::count == 0);
#endif
}

0 comments on commit 4a152f1

Please sign in to comment.