Skip to content

Commit 857a285

Browse files
committed
Failing test disabled on clang (compiler bug)
1 parent 4c7ff46 commit 857a285

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

tests/test-app/constexpr_algos_tests.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ TEST_CASE("consteval_for - compile-time operation", "[constexpr-algos]")
208208
SUCCEED();
209209
}
210210

211+
// Guarded out on Clang: it mis-instantiates the lambda's template operator() during constant evaluation and
212+
// rejects it as "undefined function ... cannot be used in a constant expression" (unfixed upstream bug
213+
// https://github.com/llvm/llvm-project/issues/107018). Only this test exercises the bool early-exit path;
214+
// real users (pack::index_for_type) use the void path and are unaffected. Remove the guard once Clang fixes it.
215+
#ifndef __clang__
211216
TEST_CASE("consteval_for -> bool - early exit at runtime", "[constexpr-algos]")
212217
{
213218
consteval_for<5, 200>([]<auto index>() consteval -> bool {
@@ -219,3 +224,4 @@ TEST_CASE("consteval_for -> bool - early exit at runtime", "[constexpr-algos]")
219224

220225
SUCCEED();
221226
}
227+
#endif

utility/constexpr_algorithms.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ namespace detail {
1212
{
1313
if constexpr (std::is_same_v<bool, decltype(f.template operator()<First>())>)
1414
{
15-
constexpr bool proceed = f.template operator()<First>();
16-
if constexpr (proceed)
15+
if constexpr (f.template operator()<First>() == true)
1716
consteval_for_T<T, First + 1, Last>(f);
1817
}
1918
else

0 commit comments

Comments
 (0)