| 1 |
// Test lambda mangling |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
// { dg-require-weak "" } |
| 4 |
// { dg-options "-fno-inline" } |
| 5 |
|
| 6 |
template<typename T> struct R { |
| 7 |
static int x; |
| 8 |
}; |
| 9 |
// "int i;" makes the op() non-constexpr in C++17. In C++20, it does not. |
| 10 |
template<typename T> int R<T>::x = []{int i; return 1;}(); |
| 11 |
template int R<int>::x; |
| 12 |
// Type of lambda in intializer of R<int>::x: N1RIiE1xMUlvE_E |
| 13 |
// Corresponding operator(): _ZNK1RIiE1xMUlvE_clEv |
| 14 |
// { dg-final { scan-assembler-not "_ZNK1RIiE1xMUlvE_clEv" } } |
| 15 |
// { dg-final { scan-assembler-not "weak\[^\n\r\]*_?_ZNK1RIiE1xMUlvE_clEv" } } |