aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-26 06:57:13 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-26 06:57:13 +0000
commit9c127392efe91dadacbe28ca16b8a9a5fa7990b3 (patch)
tree69a8a4a59dc72c50a496a416a696f6beba4898c5
parent94e8ee520a00dcbdc896df07973d68f5ec7fdac8 (diff)
Do not mark the destructor of a function parameter's type. Fixes PR6709.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99615 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaChecking.cpp4
-rw-r--r--test/CXX/class.access/p4.cpp4
-rw-r--r--test/SemaCXX/destructor.cpp5
3 files changed, 7 insertions, 6 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 46aedfcb28..f2520fc5eb 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -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;
diff --git a/test/CXX/class.access/p4.cpp b/test/CXX/class.access/p4.cpp
index 07ecc6caf0..4da9eef25d 100644
--- a/test/CXX/class.access/p4.cpp
+++ b/test/CXX/class.access/p4.cpp
@@ -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}}
}
diff --git a/test/SemaCXX/destructor.cpp b/test/SemaCXX/destructor.cpp
index 7010d2e0d0..ae3dc86e97 100644
--- a/test/SemaCXX/destructor.cpp
+++ b/test/SemaCXX/destructor.cpp
@@ -78,3 +78,8 @@ namespace PR6421 {
}
};
}
+
+namespace PR6709 {
+ template<class T> class X { T v; ~X() { ++*v; } };
+ void a(X<int> x) {}
+}