aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/lambda-mangle.C
blob: 35abc9179e70e8f990b91803f037a2c7cc48f3cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Test lambda mangling
// { dg-do compile { target c++20 } }
// { dg-require-weak "" }
// { dg-options "-fno-inline" }

template<typename T> struct R {
  static int x;
};
// "int i;" makes the op() non-constexpr in C++17.  In C++20, it does not.
template<typename T> int R<T>::x = []{int i; return 1;}();
template int R<int>::x;
// Type of lambda in intializer of R<int>::x: N1RIiE1xMUlvE_E
// Corresponding operator(): _ZNK1RIiE1xMUlvE_clEv
// { dg-final { scan-assembler-not "_ZNK1RIiE1xMUlvE_clEv" } }
// { dg-final { scan-assembler-not "weak\[^\n\r\]*_?_ZNK1RIiE1xMUlvE_clEv" } }