| 1 |
// PR c++/122253 |
| 2 |
// { dg-additional-options "-fmodules -Wtemplate-names-tu-local" } |
| 3 |
|
| 4 |
export module M; |
| 5 |
|
| 6 |
template <int> struct ic {}; |
| 7 |
struct S { |
| 8 |
constexpr operator int() const { return 5; } |
| 9 |
constexpr int operator&() const { return 8; } |
| 10 |
}; |
| 11 |
|
| 12 |
template <typename T> inline void a(T) { |
| 13 |
T a; |
| 14 |
static T b; |
| 15 |
ic<a>{}; |
| 16 |
ic<b>{}; |
| 17 |
ic<&a>{}; |
| 18 |
ic<&b>{}; |
| 19 |
} |
| 20 |
|
| 21 |
template <typename T> inline auto b(T x) { |
| 22 |
return [&](auto y) { |
| 23 |
return [=](auto z) { |
| 24 |
return ic<(int)x + (int)&y + (int)z>{}; |
| 25 |
}; |
| 26 |
}; |
| 27 |
} |
| 28 |
|
| 29 |
template void a(S); |
| 30 |
ic<5 + 8 + 5> x = b(S{})(S{})(S{}); |