================
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 -O2 -emit-llvm -o 
/dev/null %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 -O2 
-disable-llvm-passes -emit-llvm -o - %s | FileCheck %s
+
+struct E {
+  E();
+  template<typename T>
+  E(T t);
+  ~E();
+};
+
+E::E() {
+  struct {
+    // CHECK-DAG: _ZTSN1EC13$_012anotherValueMUlvE_E
+    int anotherValue = [x = 1] { return x; }();
+  } obj;
+}
+
+template<typename T>
+E::E(T t) {
+  struct {
+    // CHECK-DAG: _ZTSN1EC1IiEUt_UlvE_E
----------------
efriedma-quic wrote:

This mangling isn't correct.

Compare the following in clang vs. gcc:

```
struct E {
  E();
  template<typename T>
  E(T t);
  ~E();
};
inline E::E() {
  struct {
    int anotherValue = [x = 1] { static int z = 10; return z+++x; }();
  } obj;
}
template<typename T>
E::E(T t) {
  struct {
    // CHECK-DAG: _ZTSN1EC1IiEUt_UlvE_E
    int anotherValue = [x = 1] { static int z = 10; return z+++x; }();
    int anotherValue2 = [x = 1] { static int z = 10; return z+++x; }();
  } obj;
}
E e{1};
E e2;
```

But I'm not sure it's actually directly connected to your patch; maybe file a 
bug.

https://github.com/llvm/llvm-project/pull/181068
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to