-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsC++20 concepts
Description
When using __attribute__((enable_if(...)))
with a condition that may be ill-formed, you cannot use a requires
clause to constrain the function to only be considered in the well-formed cases, because apparently the enable_if
condition is considered first.
The workaround is to use SFINAE instead, which is ugly.
Sample code: https://godbolt.org/z/x3MjWv1ET
IMO, enable_if should be considered after constraint satisfaction (like with SFINAE), not before. Optionally, if the condition for enable_if
is ill-formed the overload could just be considered to be not enabled, but that might be a bridge too far.
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsC++20 concepts