| 1 |
// { dg-additional-options "-fmodules-ts" } |
| 2 |
// friend injection then definition injection |
| 3 |
|
| 4 |
export module foo; |
| 5 |
// { dg-module-cmi foo } |
| 6 |
|
| 7 |
template <typename T> class TPL |
| 8 |
{ |
| 9 |
friend void foo (T, void *); // { dg-warning "non-template function" } |
| 10 |
|
| 11 |
T member; |
| 12 |
}; |
| 13 |
|
| 14 |
template <typename U> class DEF |
| 15 |
{ |
| 16 |
friend void foo (U x, void *p) |
| 17 |
{ |
| 18 |
auto *obj = reinterpret_cast<TPL<U> *> (p); |
| 19 |
|
| 20 |
obj->member = x; |
| 21 |
} |
| 22 |
}; |
| 23 |
|
| 24 |
template class TPL<float>; // instantiate |
| 25 |
template class DEF<float>; // instantiate |