Declare variant directives declare base functions to have the specified function variant. The context selector in the match clause is associated with the variant.
The OpenMP context for a direct call to a given base function is defined according to Section 7.1. If a declare variant directive for the base function is visible at the call site and the static part of the context selector that is associated with the declared function variant is compatible with the OpenMP context of the call according to the matching rules defined in Section 7.3 then the variant is a replacement candidate to be called instead of the base function. Replacement candidates are ordered in decreasing order of the score associated with the context selector. If two replacement candidates have the same score then their order is implementation defined.
The list of dynamic replacement candidates is the prefix of the sorted list of replacement candidates up to and including the first candidate for which the corresponding context selector is static.
The first dynamic replacement candidate for which the corresponding context selector is compatible, according to the matching rules defined in Section 7.3, is called instead of the base function. If no compatible candidate exists then the base function is called.
Expressions that appear in the context selector of a match clause are evaluated if no prior dynamic replacement candidate has a compatible context selector, and the number of times each expression is evaluated is implementation defined. All variables referenced by these expressions are considered to be referenced at the call site.
For indirect function calls that can be determined to call a particular base function, whether any variant replacement occurs is unspecified.
Any differences that the specific OpenMP context requires in the prototype of the variant from the base function prototype are implementation defined.
Different declare variant directives may be specified for different declarations of the same base function.
Restrictions
Restrictions to declare variant directives are as follows:An adjust_args clause or append_args clause can only be specified if the dispatch selector of the construct selector set appears in the match clause.
Cross References