Skip to content

Commit fc8b88f

Browse files
committed
Fix compatibility
1 parent 5745334 commit fc8b88f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

libcxx/test/std/containers/sequences/vector.bool/exceptions.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ int main(int, char**) {
101101
try { // Throw in vector(const vector&, const allocator_type&) from allocator
102102
throwing_allocator<bool> alloc(false, false);
103103
AllocVec vec(alloc);
104-
vec.emplace_back(true);
104+
vec.push_back(true);
105105
alloc.throw_on_copy_ = true;
106106
AllocVec vec2(vec, alloc);
107107
} catch (int) {
@@ -111,7 +111,7 @@ int main(int, char**) {
111111
try { // Throw in vector(vector&&, const allocator_type&) from allocator
112112
throwing_allocator<bool> alloc(false, false);
113113
AllocVec vec(alloc);
114-
vec.emplace_back(true);
114+
vec.push_back(true);
115115
alloc.throw_on_copy_ = true;
116116
AllocVec vec2(std::move(vec), alloc);
117117
} catch (int) {

libcxx/test/support/exception_test_helpers.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef EXCEPTION_TEST_HELPER_H
10-
#define EXCEPTION_TEST_HELPER_H
9+
#ifndef EXCEPTION_TEST_HELPERS_H
10+
#define EXCEPTION_TEST_HELPERS_H
1111

1212
#include "count_new.h"
1313

@@ -23,6 +23,11 @@ struct throwing_allocator {
2323
throw 0;
2424
}
2525

26+
throwing_allocator(const throwing_allocator& rhs) : throw_on_copy_(rhs.throw_on_copy_) {
27+
if (throw_on_copy_)
28+
throw 0;
29+
}
30+
2631
template <class U>
2732
throwing_allocator(const throwing_allocator<U>& rhs) : throw_on_copy_(rhs.throw_on_copy_) {
2833
if (throw_on_copy_)
@@ -79,4 +84,4 @@ inline void check_new_delete_called() {
7984
assert(globalMemCounter.aligned_new_array_called == globalMemCounter.aligned_delete_array_called);
8085
}
8186

82-
#endif // EXCEPTION_TEST_HELPER_H
87+
#endif // EXCEPTION_TEST_HELPERS_H

0 commit comments

Comments
 (0)