]> granicus.if.org Git - clang/commitdiff
Do not mark the destructor of a function parameter's type. Fixes PR6709.
authorDouglas Gregor <dgregor@apple.com>
Fri, 26 Mar 2010 06:57:13 +0000 (06:57 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 26 Mar 2010 06:57:13 +0000 (06:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99615 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaChecking.cpp
test/CXX/class.access/p4.cpp
test/SemaCXX/destructor.cpp

index 46aedfcb28865d109cfa21db1888a4d23b689792..f2520fc5eb7f3b291caca00117fb3c1d5ec4f126 100644 (file)
@@ -2254,10 +2254,6 @@ bool Sema::CheckParmsForFunctionDef(FunctionDecl *FD) {
         Diag(Param->getLocation(), diag::err_array_star_in_function_definition);
       }
     }
-
-    if (getLangOptions().CPlusPlus)
-      if (const RecordType *RT = Param->getType()->getAs<RecordType>())
-        FinalizeVarWithDestructor(Param, RT);
   }
 
   return HasInvalidParm;
index 07ecc6caf0a5fe4846def093018ff175f6214aad..4da9eef25ddc13e17a1f060156719326894f71f0 100644 (file)
@@ -101,14 +101,14 @@ namespace test2 {
 namespace test3 {
   class A {
   private:
-    ~A(); // expected-note 3 {{declared private here}}
+    ~A(); // expected-note 2 {{declared private here}}
     static A foo;
   };
 
   A a; // expected-error {{variable of type 'test3::A' has private destructor}}
   A A::foo;
 
-  void foo(A param) { // expected-error {{variable of type 'test3::A' has private destructor}}
+  void foo(A param) { // okay
     A local; // expected-error {{variable of type 'test3::A' has private destructor}}
   }
 
index 7010d2e0d092be2f29b4bfe83fd96658fdb7e8c7..ae3dc86e97f507bc58b9e306fa96f343af5f1d7e 100644 (file)
@@ -78,3 +78,8 @@ namespace PR6421 {
     }
   };
 }
+
+namespace PR6709 {
+  template<class T> class X { T v; ~X() { ++*v; } };
+  void a(X<int> x) {}
+}