C standard defines set of pragmas that modify code generation for
operations on floating point values. In C++ code may be obtained using
template instantiation and from practical viewpoint it is necessary to
have possibility to modify code generation in this case as well. This
change implements interaction of FP pragmas with function template
instantiations.
If a function template contains a floating-point control pragma, the
latter is a part of template definition and presents in all
instantiations. If a pragma in placed outside any function it acts on
function templates in the same way as on functions. For the task of
function instantiation such pragma is equivalent to the same pragma put
at the beginning of all affected function bodies.
In the case is explicit instantiation there is apparent connection
between a point in source code and instantiated function. It can
support interaction of pragmas that act in that point. For example, in
the code:
#pragma STDC FENV_ROUND FE_DOWNWARD template float func_05<short>(float, float);
the instantiated function is created with the specified constant
rounding mode. The effect is same as if the template pattern were
textually inserted into the code with needed replacements.
Implicit instantiations occur with FP options deduced from LangOpts.
They have no apparent connection to source code and are not influenced
by FP pragmas.