cmake: raise Clang's expression nesting limit - #2185
Merged
Conversation
Clang caps expression nesting at 256. Avendish assembles the module list with
std::tuple_cat, and libstdc++'s tuple constructor folds over every element:
explicit(!(__is_implicitly_default_constructible_v<_Elements> && ...))
giving one term per module. Once the count passes 256 that stops being a
diagnostic and becomes a hard error:
tuple:965: fatal error: instantiating fold expression with 330 arguments
exceeded expression nesting limit
It is at 330 today and only grows as plug-ins are added, so this raises the
ceiling well clear rather than to the next value above the current count.
Costs nothing when the limit is not reached, and GCC has no equivalent cap.
jcelerier
force-pushed
the
fix/clang-bracket-depth
branch
from
August 9, 2026 22:59
04c7f32 to
89a28b5
Compare
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.
Clang caps expression nesting at 256. Avendish assembles the module list with
std::tuple_cat, and libstdc++'s tuple constructor folds over every element:explicit(!(__is_implicitly_default_constructible_v<_Elements> && ...))giving one term per module. Once the count passes 256 that stops being a diagnostic and becomes a hard error:
It is at 330 today and only grows as plug-ins are added, so this sets the ceiling well clear rather than just above the current count.
-fbracket-depthis Clang-only and costs nothing when the limit is not reached; GCC has no equivalent cap, so GCC builds are unaffected.Seen on the
clang-20Ubuntu plucky legs of #2176, #2179, #2181, #2182 and #2183 — 8 failing jobs across those PRs.