================ @@ -441,3 +441,31 @@ void testLeakBecauseNTTPIsNotDeallocation() { void* p = ::operator new(10); deallocate_via_nttp<not_free>(p); } // leak-warning{{Potential leak of memory pointed to by 'p'}} + +namespace optional_union { + template <typename T> + class unique_ptr { + T *q; + public: + unique_ptr() : q(new T) {} + ~unique_ptr() { + delete q; + } + }; + + union custom_union_t { + unique_ptr<int> present; + char notpresent; + custom_union_t() : present(unique_ptr<int>()) {} + ~custom_union_t() {}; ---------------- Xazax-hun wrote:
Nit: redundant semi after the definition. https://github.com/llvm/llvm-project/pull/122330 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits