On 8/25/25 09:29, Jakub Jelinek wrote:
On Mon, Aug 25, 2025 at 09:13:58AM -0600, Sandra Loosemore wrote:
How? Declare variant substitution presently happens primarily during
gimplification which is way before any vectorization happens. And fixing
the various bugs esp in the C++ front end with regard to doing the name
lookup/template expansion/overload resolution using the actual arguments at
the call site will move the generation of the call_expr to the variant even
That is not what should be done. The lookup should be done at the declare
variant declaration side, that is how the design has been since that
meeting. The compiler records the variants and later on just picks from
that list of variants based on the condition.
Starting with OpenMP 5.2, the spec explicitly says differently for C++:
"The function variant is determined by base language standard name
lookup rules ([basic.lookup]) of variant-name using the argument types
at the call site..."
This means, among other things, that the same variant-name could resolve
to different functions for calls appearing in different class/namespace
scopes, the same as any other (unqualified) name appearing explicitly in
those scopes.
-Sandra