Skip to content

Commit 370f397

Browse files
committed
Apple, fix your compiler!
1 parent fcb0b4a commit 370f397

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

parameter_pack/parameter_pack_helpers.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ namespace pack {
1515
[[nodiscard]] consteval optional_consteval<size_t> index_for_type() noexcept
1616
{
1717
optional_consteval<size_t> index;
18-
consteval_for<0, sizeof...(Args)>([&index]<size_t I>() consteval {
18+
// The explicit -> void keeps consteval_for's return-type probe (decltype on the body) from
19+
// instantiating this body during deduction, dodging an Apple Clang bug that rejects the consteval
20+
// calls on captured 'index' as non-constant. Not needed by GCC/MSVC; the real invocation is fine everywhere.
21+
consteval_for<0, sizeof...(Args)>([&index]<size_t I>() consteval -> void {
1922
if (!index) // The index of the first occurrence is stored
2023
{
2124
if constexpr (std::is_same_v<T, type_by_index<I, Args... >>)

0 commit comments

Comments
 (0)