| 1 |
// { dg-additional-options -fmodules-ts } |
| 2 |
// { dg-module-do run } |
| 3 |
|
| 4 |
export module node; |
| 5 |
// { dg-module-cmi node } |
| 6 |
|
| 7 |
export template <typename T> void assert (T t) |
| 8 |
{ |
| 9 |
static_assert (sizeof (T) == sizeof (int), "whoops"); |
| 10 |
} |
| 11 |
|
| 12 |
export class other |
| 13 |
{ |
| 14 |
public: |
| 15 |
other () :f (5) {} |
| 16 |
void o () { } |
| 17 |
int f; |
| 18 |
}; |
| 19 |
|
| 20 |
export template<typename T> class baselink : T, other |
| 21 |
{ |
| 22 |
public: |
| 23 |
int Frob () |
| 24 |
{ |
| 25 |
o (); |
| 26 |
return this->T::frob (); |
| 27 |
} |
| 28 |
}; |
| 29 |
|
| 30 |
export template <typename T> bool trait () |
| 31 |
{ |
| 32 |
return __has_nothrow_assign(T); |
| 33 |
} |
| 34 |
|
| 35 |
export inline bool ptrmemdata (other const &obj) |
| 36 |
{ |
| 37 |
int other::*ptr = &other::f; |
| 38 |
|
| 39 |
return (obj.*ptr) == 5; |
| 40 |
} |
| 41 |
|
| 42 |
export template<typename T> int ptrmemfn (T const &obj) |
| 43 |
{ |
| 44 |
int (T::*ptr) () const = &T::frob; |
| 45 |
return (obj.*ptr) (); |
| 46 |
} |