Technical data

Cray Standard C/C++ Reference Manual
In the preceding example, f1(double) and g1(double) are not instantiated
because no bodies are supplied, but no errors will be produced during the
compilation. If no bodies are supplied at link time, a linker error is issued.
A member function name (such as A<int>::f) can be used as a #pragma
directive argument only if it refers to a single, user-defined member function
(that is, not an overloaded function). Compiler-generated functions are
not considered, so a name can refer to a user-defined constructor even if a
compiler-generated copy constructor of the same name exists. Overloaded
member functions can be instantiated by providing the complete member
function declaration, as in the following example:
#pragma _CRI instantiate char* A<int>::f(int, char*)
The argument to an instantiation directive cannot be a compiler-generated
function, an inline function, or a pure virtual function.
6.5 Implicit Inclusion
The implicit inclusion feature implies that if the compiler needs a definition to
instantiate a template entity declared in a .h file, it can implicitly include the
corresponding .C file to get the source code for the definition. For example,
if a template entity ABC::f is declared in file xyz.h, and an instantiation of
ABC::f is required in a compilation, but no definition of ABC::f appears in
the source code processed by the compilation, the compiler will look to see if
a file xyz.C exists and, if so, it processes it as if it were included at the end of
the main source file.
To find the template definition file for a given template entity, the Cray Standard
C++ compiler must know the full path name to the file in which the template
was declared and whether the file was included using the system include
syntax (such as #include <file.h>). This information is not available for
preprocessed source code containing #line directives. Consequently, the Cray
Standard C++ compiler does not attempt implicit inclusion for source code that
contains #line directives.
The set of definition-file suffixes that are tried by default, is .c, .C, .cpp, .CPP,
.cxx, .CXX, and .cc.
Implicit inclusion works well with automatic instantiation, however, they are
independent. They can be enabled or disabled independently, and implicit
inclusion is still useful without automatic instantiation.
116 S217936