@@ -101,7 +101,17 @@ TEMPLATE_LIST_TEST_CASE(
101101 if constexpr (eoft_allocates<TestType>) {
102102 fail_next_allocation{}, TestType{raw_ptr};
103103 } else {
104+ #if !defined(OUP_COMPILER_LLVM) || !defined(NDEBUG)
104105 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
105115 }
106116 }
107117
@@ -120,8 +130,18 @@ TEMPLATE_LIST_TEST_CASE(
120130 if constexpr (eoft_allocates<TestType>) {
121131 fail_next_allocation{}, TestType{raw_ptr, deleter};
122132 } else {
133+ #if !defined(OUP_COMPILER_LLVM) || !defined(NDEBUG)
123134 REQUIRE_THROWS_AS (
124135 (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
125145 }
126146 }
127147
0 commit comments