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

Zequan Wu via cfe-commits cfe-commits at lists.llvm.org
Mon May 13 18:05:21 PDT 2024


ZequanWu wrote:

```
$ cat a.cpp
namespace std {
template <int a> struct b {
  static const int c = a;
};
template <bool, class d> using e = d;
template <class f> struct p {
  using g = f;
};
template <bool, class, class h> using i = p<h>::g;
template <class> class initializer_list {};
template <class d> using j = __remove_pointer(d);
template <class d> using k = j<d>;
template <typename, typename> constexpr bool l = b<__is_base_of(int, int)>::c;
template <bool m, typename n> using ab = e<m, n>;
template <typename n, typename q> using o = ab<l<n, q>, n>;
template <typename... ac> constexpr bool ad = (l<ac, int> && ...);
template <typename...> struct u;
template <typename... ac> using ae = u<ac...>::g;
template <typename n> struct u<n> {
  using g = n;
};
template <typename n, int> class t {
public:
  t(initializer_list<n>);
};
namespace ag {
template <bool, typename...> struct D;
template <typename... s> struct D<true, s...> {
  using ah = ae<k<s>...>;
  using g = i<0, ah, ah *>;
};
}
template <typename... s> using r = ag::D<ad<>, s...>::g;
template <typename... s> t(s...) -> t<r<s...>, sizeof...(s)>;
class v {
public:
  template <typename n, typename an> o<n, int> *w(an &&);
};
using ap = v;
struct aq : ap {
  int *ar = w<int>(t{w<int>(int{})});
  aq() {}
}
$ clang a.cpp
[crash]
```

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


More information about the cfe-commits mailing list