| 1 |
// { dg-module-do run } |
| 2 |
// { dg-additional-options "-fmodules-ts" } |
| 3 |
|
| 4 |
export module tom.riddle; |
| 5 |
// { dg-module-cmi tom.riddle } |
| 6 |
|
| 7 |
export inline auto One (int a) |
| 8 |
{ |
| 9 |
struct X { |
| 10 |
int x; |
| 11 |
// p1779 makes these things not-inline, which is a surprise. |
| 12 |
// Asking CWG |
| 13 |
inline X(int a) :x(a){} |
| 14 |
inline operator int () const {return x;} |
| 15 |
}; |
| 16 |
|
| 17 |
return X(a); |
| 18 |
} |
| 19 |
|
| 20 |
// Look Ma! this isn't inline! |
| 21 |
export auto Two (int a) |
| 22 |
{ |
| 23 |
struct Y { |
| 24 |
int x; |
| 25 |
// In this case we do manage to emit these fns (if not marked as |
| 26 |
// inline), but we give them internal linkage, so they are not |
| 27 |
// nameable from elsewhere. Workaround for now. |
| 28 |
inline Y(int a) :x(a){} |
| 29 |
inline operator int () const {return x;} |
| 30 |
}; |
| 31 |
|
| 32 |
return Y(a); |
| 33 |
} |
| 34 |
|