Fix clang-cl build: avoid MSVC STL vectorized find on 16-byte StreamId - #30
Merged
Merged
Conversation
…clang-cl Building with the clang-cl presets against the latest MSVC STL (14.51) fails to compile CacheEngine.cpp: xutility(320): error: static assertion failed: unexpected size note: in instantiation of '_Find_vectorized<StreamCodec::StreamId, ...>' Under clang the MSVC STL trait `_Is_same_and_builtin_trivially_equality_comparable` uses the `__is_trivially_equality_comparable` builtin, which reports StreamId (two uint64_t, defaulted operator<=>) as eligible for the vectorized find fast path. That path (`_Find_vectorized`) only handles 1/2/4/8-byte elements and hard-errors on StreamId's 16 bytes. Plain MSVC `cl` hard-codes the trait to false, so only clang-cl trips over it. The identity-projected `std::ranges::find(wanted, p.id)` in StreamClaim's predicate was the sole trigger; the other find/count calls pass a projection (skipping the vectorized path) or search 8-byte/string ranges. Replace it with a predicate-based `std::ranges::none_of`, matching the idiom already used a few lines above, and comment why plain find is avoided. No behavior change; all clangcl-debug (830) and clangcl-release (828, smoke excluded) tests pass. Signed-off-by: Christian Parpart <c.parpart@lastrada.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
clangcl-debugandclangcl-releasepresets fail to compileCacheEngine.cppagainst the latest MSVC STL (14.51) with clang 22:Under clang, the MSVC STL trait
_Is_same_and_builtin_trivially_equality_comparableuses the__is_trivially_equality_comparablebuiltin, which reportsStreamId(twouint64_t, defaultedoperator<=>) as eligible for the vectorizedfindfast path. That path only handles 1/2/4/8-byte elements and hard-errors onStreamId's 16 bytes. Plain MSVCclhard-codes the trait tofalse, so only clang-cl trips over it.The identity-projected
std::ranges::find(wanted, p.id)inStreamClaim's predicate was the sole trigger — the otherfind/countcalls either pass a projection (which skips the vectorized path) or search 8-byte / string ranges. It is replaced with a predicate-basedstd::ranges::none_of, matching the idiom already used a few lines above, with a comment explaining why plainfindis avoided so it is not "simplified" back.No behavior change. All
clangcl-debug(830) andclangcl-release(828, smoke excluded) tests pass.