forked from OSchip/llvm-project
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. llvm-svn: 231451
This commit is contained in:
parent
72146af68c
commit
55905145e7
|
@ -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,
|
||||
|
@ -11859,8 +11859,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() && getLangOpts().AppleKext)
|
||||
MarkVTableUsed(Loc, Destructor->getParent());
|
||||
} else if (CXXMethodDecl *MethodDecl = dyn_cast<CXXMethodDecl>(Func)) {
|
||||
|
|
|
@ -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>;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue