[clang] [Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer (PR #87933)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Fri May 3 16:17:30 PDT 2024


================
@@ -206,13 +206,10 @@ namespace cwg1814 { // cwg1814: yes
 #endif
 }
 
-namespace cwg1815 { // cwg1815: no
+namespace cwg1815 { // cwg1815: yes
----------------
zygoloid wrote:

A test for constant evaluation would be nice here too. Maybe:
```c++
struct C { const int &r = 0; };
constexpr C c = {};
static_assert(c.r == 0);
```
or
```c++
constexpr int f() {
  A a = {};
  return a.r;
}
static_assert(f() == 0);
```

https://github.com/llvm/llvm-project/pull/87933


More information about the cfe-commits mailing list