When we create a temporary of class type that we don't immediately
bind, check accessibility of the destructor and mark the declaration
as referenced. Fixes a bunch of Boost.Regex failures.

llvm-svn: 102287
diff --git a/clang/test/CXX/class.access/p4.cpp b/clang/test/CXX/class.access/p4.cpp
index fdde735..2786aef 100644
--- a/clang/test/CXX/class.access/p4.cpp
+++ b/clang/test/CXX/class.access/p4.cpp
@@ -349,4 +349,17 @@
   void test() {
     foo(); // expected-error {{temporary of type 'test14::A' has private destructor}}
   }
+
+  class X {
+    ~X(); // expected-note {{declared private here}}
+  };
+  
+  struct Y1 {
+    operator X();
+  };
+  
+  void g() {
+    const X &xr = Y1(); // expected-error{{temporary of type 'test14::X' has private destructor}}
+  }
 }
+