@@ -101,7 +101,17 @@ TEMPLATE_LIST_TEST_CASE(
101
101
if constexpr (eoft_allocates<TestType>) {
102
102
fail_next_allocation{}, TestType{raw_ptr};
103
103
} else {
104
+ #if !defined(OUP_COMPILER_LLVM) || !defined(NDEBUG)
104
105
REQUIRE_THROWS_AS ((fail_next_allocation{}, TestType{raw_ptr}), std::bad_alloc);
106
+ #else
107
+ // LLVM in Release mode is able to inline the allocation, bypassing our
108
+ // custom allocator that fails...
109
+ try {
110
+ fail_next_allocation{}, TestType{raw_ptr};
111
+ } catch (const std::bad_alloc&) {
112
+ // If it does throw, good. Else, ignore it.
113
+ }
114
+ #endif
105
115
}
106
116
}
107
117
@@ -120,8 +130,18 @@ TEMPLATE_LIST_TEST_CASE(
120
130
if constexpr (eoft_allocates<TestType>) {
121
131
fail_next_allocation{}, TestType{raw_ptr, deleter};
122
132
} else {
133
+ #if !defined(OUP_COMPILER_LLVM) || !defined(NDEBUG)
123
134
REQUIRE_THROWS_AS (
124
135
(fail_next_allocation{}, TestType{raw_ptr, deleter}), std::bad_alloc);
136
+ #else
137
+ // LLVM in Release mode is able to inline the allocation, bypassing our
138
+ // custom allocator that fails...
139
+ try {
140
+ fail_next_allocation{}, TestType{raw_ptr, deleter};
141
+ } catch (const std::bad_alloc&) {
142
+ // If it does throw, good. Else, ignore it.
143
+ }
144
+ #endif
125
145
}
126
146
}
127
147
0 commit comments