summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2015-04-20 15:17:50 +0000
committerTom Stellard <thomas.stellard@amd.com>2015-04-20 15:17:50 +0000
commit14545f84de5008e75ea9b5ad1f7fce043e717ae7 (patch)
tree5ff3c135c10e8c8ae72ca0002dc9e6d6a0901984
parent0f48270c7267de0ffd6eb3026c83df4b49b0a567 (diff)
Merging r231451:
------------------------------------------------------------------------ r231451 | nicolasweber | 2015-03-06 01:01:06 -0500 (Fri, 06 Mar 2015) | 5 lines Don't crash on non-public referenced dtors in toplevel classes. Fixes PR22793, a bug that caused self-hosting to fail after the innocuous r231254. See the bug for details. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@235308 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExpr.cpp7
-rw-r--r--test/CodeGenCXX/trivial-constructor-init.cpp14
2 files changed, 19 insertions, 2 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 091fd27db8..8be11572b2 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -117,7 +117,7 @@ static AvailabilityResult DiagnoseAvailabilityOfDecl(Sema &S,
case AR_Available:
case AR_NotYetIntroduced:
break;
-
+
case AR_Deprecated:
if (S.getCurContextAvailability() != AR_Deprecated)
S.EmitAvailabilityWarning(Sema::AD_Deprecation,
@@ -11630,8 +11630,11 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func,
} else if (CXXDestructorDecl *Destructor =
dyn_cast<CXXDestructorDecl>(Func)) {
Destructor = cast<CXXDestructorDecl>(Destructor->getFirstDecl());
- if (Destructor->isDefaulted() && !Destructor->isDeleted())
+ if (Destructor->isDefaulted() && !Destructor->isDeleted()) {
+ if (Destructor->isTrivial() && !Destructor->hasAttr<DLLExportAttr>())
+ return;
DefineImplicitDestructor(Loc, Destructor);
+ }
if (Destructor->isVirtual())
MarkVTableUsed(Loc, Destructor->getParent());
} else if (CXXMethodDecl *MethodDecl = dyn_cast<CXXMethodDecl>(Func)) {
diff --git a/test/CodeGenCXX/trivial-constructor-init.cpp b/test/CodeGenCXX/trivial-constructor-init.cpp
index 9130e4e5d9..da17799dfa 100644
--- a/test/CodeGenCXX/trivial-constructor-init.cpp
+++ b/test/CodeGenCXX/trivial-constructor-init.cpp
@@ -32,3 +32,17 @@ static C c[4];
int main() {
}
+
+namespace PR22793 {
+template <typename>
+struct foo {
+protected:
+// CHECK-NOT: _ZN7PR227933fooIiED2Ev
+ ~foo() = default;
+ friend void func();
+};
+
+void func() { foo<int> f; }
+
+template struct foo<int>;
+}