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

via cfe-commits cfe-commits at lists.llvm.org
Wed May 15 04:26:57 PDT 2024


yronglin wrote:

I've a more short reproducer:
```C++
namespace std {
template <class T> class initializer_list {};
}

template <typename T, int> class C {
public:
  C(std::initializer_list<T>);
};

template <typename T> using Ptr =__remove_pointer(T) *;
template <typename T>  C(T) ->  C<Ptr<T>, sizeof(T)>;

class A {
public:
  template <typename T1, typename T2>
  T1 *some_func(T2 &&);
};

struct B : A {
  int *ar = some_func<int>(C{some_func<int>(0)});
  B() {}
};

```

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


More information about the cfe-commits mailing list