Enforce access control for the destructor in a new[] expression and mark
it as used.  Otherwise, we can fail to instantiate or validate the destructor,
which can lead to crashes in IR gen like PR10351.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135073 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/partial-destruction.cpp b/test/CodeGenCXX/partial-destruction.cpp
index f929d2d..82deca0 100644
--- a/test/CodeGenCXX/partial-destruction.cpp
+++ b/test/CodeGenCXX/partial-destruction.cpp
@@ -153,3 +153,17 @@
   }
 
 }
+
+// PR10351
+namespace test3 {
+  struct A { A(); ~A(); void *p; };
+  struct B {
+    B() {}
+    A a;
+  };
+
+  B *test() {
+    return new B[10];
+    // invoke void @_ZN5test31BD1Ev(
+  }
+}