Skip tests that expect an exception be thrown.
Differential Revision: https://reviews.llvm.org/D26606
llvm-svn: 287866
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <memory>
// template <class InputIterator, class ForwardIterator>
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
struct B
{
static int count_;
static int population_;
int data_;
explicit B() : data_(1) { ++population_; }
- B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_; ++population_; }
+ B(const B &b) {
+ ++count_;
+ if (count_ == 3)
+ TEST_THROW(1);
+ data_ = b.data_;
+ ++population_;
+ }
~B() {data_ = 0; --population_; }
};
B* bp = (B*)pool;
B b[N];
assert(B::population_ == N);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
std::uninitialized_copy(b, b+N, bp);
{
assert(B::population_ == N);
}
+#endif
B::count_ = 0;
std::uninitialized_copy(b, b+2, bp);
for (int i = 0; i < 2; ++i)
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <memory>
// template <class InputIterator, class Size, class ForwardIterator>
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
struct B
{
static int count_;
static int population_;
int data_;
explicit B() : data_(1) { ++population_; }
- B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_; ++population_; }
+ B(const B &b) {
+ ++count_;
+ if (count_ == 3)
+ TEST_THROW(1);
+ data_ = b.data_;
+ ++population_;
+ }
~B() {data_ = 0; --population_; }
};
B* bp = (B*)pool;
B b[N];
assert(B::population_ == N);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
std::uninitialized_copy_n(b, 5, bp);
{
assert(B::population_ == N);
}
+#endif
B::count_ = 0;
std::uninitialized_copy_n(b, 2, bp);
for (int i = 0; i < 2; ++i)
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <memory>
// template <class ForwardIterator, class Size, class T>
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
struct B
{
static int count_;
static int population_;
int data_;
explicit B() : data_(1) { ++population_; }
- B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_; ++population_; }
+ B(const B &b) {
+ ++count_;
+ if (count_ == 3)
+ TEST_THROW(1);
+ data_ = b.data_;
+ ++population_;
+ }
~B() {data_ = 0; --population_; }
};
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
assert(B::population_ == 0);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
std::uninitialized_fill_n(bp, 5, B());
{
assert(B::population_ == 0);
}
+#endif
B::count_ = 0;
B* r = std::uninitialized_fill_n(bp, 2, B());
assert(r == bp + 2);
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <memory>
// template <class ForwardIterator, class T>
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
struct B
{
static int count_;
static int population_;
int data_;
explicit B() : data_(1) { ++population_; }
- B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_; ++population_; }
+ B(const B &b) {
+ ++count_;
+ if (count_ == 3)
+ TEST_THROW(1);
+ data_ = b.data_;
+ ++population_;
+ }
~B() {data_ = 0; --population_; }
};
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
assert(B::population_ == 0);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
std::uninitialized_fill(bp, bp+N, B());
{
assert(B::population_ == 0);
}
+#endif
B::count_ = 0;
std::uninitialized_fill(bp, bp+2, B());
for (int i = 0; i < 2; ++i)