| 1 |
// { dg-do assemble } |
| 2 |
// 980924 bkoz |
| 3 |
// just a quick test for export, to make sure we are warning for it. |
| 4 |
// CHANGE ME when it's supported |
| 5 |
|
| 6 |
|
| 7 |
// 14 Templates |
| 8 |
//p 6 |
| 9 |
// A namespace-scope declaration or definintion of a non-line function |
| 10 |
// template, a non-inline member function template, a non-inline |
| 11 |
// member function of a class template or a static data member of a |
| 12 |
// class template may be preceeded by the export keyword. If such a |
| 13 |
// template is defined in the same translation unit in which it is |
| 14 |
// declared as exported, the definition is considered to be |
| 15 |
// exported. The first declaration of the template containing the |
| 16 |
// export keyword must not follow the definition. (meaning that export |
| 17 |
// can't beredeclared as non-export??) |
| 18 |
|
| 19 |
// 1 |
| 20 |
// template definition |
| 21 |
export template <class T> // { dg-message "export" } |
| 22 |
bool templ_one(T a) { |
| 23 |
if (a > 0) |
| 24 |
return true; |
| 25 |
else |
| 26 |
return false; |
| 27 |
} |
| 28 |
|
| 29 |
|
| 30 |
// 2 |
| 31 |
// static data, mf, mf template |
| 32 |
template <class T> |
| 33 |
class X_one { |
| 34 |
unsigned short id; |
| 35 |
T type; |
| 36 |
public: |
| 37 |
static const bool is_specialized ; |
| 38 |
|
| 39 |
X_one(const unsigned short& us = 5): id(us), type(T(0)) {} |
| 40 |
unsigned short ret_id (); |
| 41 |
template <class T2> bool compare_ge(T2 test); |
| 42 |
}; |
| 43 |
|
| 44 |
export template <class T> // { dg-message "export" } |
| 45 |
const bool X_one<T>::is_specialized = false; |
| 46 |
|
| 47 |
export template <class T> // { dg-message "export" } |
| 48 |
unsigned short X_one<T>::ret_id() { |
| 49 |
return id; |
| 50 |
} |
| 51 |
|
| 52 |
export template <class T2> // { dg-message "export" } |
| 53 |
bool compare_ge(T2 test) { |
| 54 |
if (test > type) // { dg-error "" } .* |
| 55 |
return true; |
| 56 |
return false; |
| 57 |
} |
| 58 |
|