fix: constexpr function local must not be static (GCC 11/12 portability) - #390
Merged
Conversation
`value()` declared its `needs_fp` compile-time selector as a `static constexpr` local. A `static` local in a `constexpr` function is only well-formed from GCC 13 / Clang 17 (P2647); GCC 11 and 12 reject it with "declared 'static' in 'constexpr' function", so a translation unit that instantiates `value()` fails to compile there. The variable is used only as a `std::conditional_t` condition — its address is never taken and it is never materialized — so dropping `static` is behavior-identical on every compiler while restoring the build on GCC 11/12.
Merged
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.
unit::value()declared itsneeds_fpcompile-time selector as astatic constexprlocal. Astaticlocal inside aconstexprfunction is only well-formed from GCC 13 / Clang 17 (P2647); GCC 11 and 12 reject it:so a translation unit that instantiates
value()fails to compile on those compilers. (Surfaced by a downstream project whose CI builds on GCC 11.)needs_fpis used only as astd::conditional_tcondition — its address is never taken and it is never materialized — so droppingstaticis behavior-identical on every compiler while restoring the build on GCC 11/12.Verified: full suite 467/467 on GCC 15; and under a GCC 11 container the pre-fix tree fails with the error above while the fixed tree compiles. The declared support floor stays GCC 13 (this is a free portability widening, not a new supported target).