* typeck2.c (digest_nsdmi_init): Set tf_no_cleanup for direct-init.
From-SVN: r273596
+2019-07-19 Jason Merrill <jason@redhat.com>
+
+ PR c++/85552 - wrong instantiation of dtor for DMI.
+ * typeck2.c (digest_nsdmi_init): Set tf_no_cleanup for direct-init.
+
2019-07-19 Nina Dinka Ranns <dinka.ranns@gmail.com>
PR c++/63149 - Wrong auto deduction from braced-init-list.
tree type = TREE_TYPE (decl);
int flags = LOOKUP_IMPLICIT;
if (DIRECT_LIST_INIT_P (init))
- flags = LOOKUP_NORMAL;
+ {
+ flags = LOOKUP_NORMAL;
+ complain |= tf_no_cleanup;
+ }
if (BRACE_ENCLOSED_INITIALIZER_P (init)
&& CP_AGGREGATE_TYPE_P (type))
init = reshape_init (type, init, complain);
--- /dev/null
+// PR c++/85552
+// { dg-do compile { target c++11 } }
+
+template<typename T>
+struct uptr {
+ uptr() { }
+ uptr(void*) { }
+ ~uptr() { static_assert(sizeof(T), "complete type"); }
+};
+
+class S;
+
+class Compiles
+{
+ uptr<S> s;
+};
+
+class DoesntCompile
+{
+ ~DoesntCompile();
+ DoesntCompile();
+
+ uptr<S> s1 { };
+ uptr<S> s2 { nullptr };
+};
+
+int main()
+{
+ return 0;
+}