Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
instantiation_before_definition.h
Go to the documentation of this file.
1
2
24#ifndef INSTANTIATION_BEFORE_DEFINITION_INCLUDED
25#define INSTANTIATION_BEFORE_DEFINITION_INCLUDED
26
27// NOTE: do not #include config.h here and avoid relying
28// the config infrastructure automatically establishing
29// dependencies on other config tests (headers are not
30// scanned for such dependencies)
31
32template <class T>
34
35template <class T>
37{
40 }
41
42 // defined later, lexically after the explicit instantiation directives
43 // below, but not referenced by another member of this class to exercise
44 // (for example) gcc 4.0 bug #623
46
47 // same as above but also referenced by another member of this class
49};
50
51#if defined (INSTANTIATE_TEMPLATE)
52
53template int instantiated_before_defined (int);
54template struct InstantiatedBeforeDefined<int>;
55
56#elif defined (EXTERN_TEMPLATE)
57
58# if __GNUG__ >= 3
59 // disable gcc 3.x (and beyond) error: ISO C++ forbids the use
60 // of `extern' on explicit instantiations
61# pragma GCC system_header
62# endif // gcc >= 3
63
64# ifndef SPECIALIZE_FUNCTION_TEMPLATE
65extern template int instantiated_before_defined (int);
66# else // if defined (SPECIALIZE_FUNCTION_TEMPLATE)
67template<> int instantiated_before_defined (int);
68# endif // SPECIALIZE_FUNCTION_TEMPLATE
69
70extern template struct InstantiatedBeforeDefined<int>;
71
72#endif // INSTANTIATE_TEMPLATE, EXTERN_TEMPLATE
73
74#if defined (INCLUDE_CC_FILE)
76#endif // INCLUDE_CC_FILE
77
78#endif // INSTANTIATION_BEFORE_DEFINITION_INCLUDED
#define T
Definition 17.names.cpp:163
#define t
Definition 17.names.cpp:136
T instantiated_before_defined(T)