Correct misuses of __has_cpp_attribute
#4812
Open
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.
Pull Request Prelude
Changes Proposed
__has_cpp_attribute
is for detecting support for attribute-tokens likefallthrough
orunlikely
. These queries with feature-test macro names are always going to fail since no implementation will ever support an attribute-token with the same name as a feature-test macro. Given the conditional use of library facilities, the intent here is clearly to test the feature-test macros to determine support for those facilities, so let's do that instead.I've also fixed the using-declaration for
std::to_underlying
.Drive-by: Removed extraneous
inline
in the definition of theconstexpr
fallback forto_underlying
;constexpr
functions are implicitly inline.Issues addressed: None