[PATCH] D69225: Sema: Fixes a crash with a templated destructor
Mark de Wever via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 7 12:23:34 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2b943c46873a: [Sema] Fixes a crash with a templated destructor (authored by Mordante).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69225/new/
https://reviews.llvm.org/D69225
Files:
clang/lib/Sema/SemaLookup.cpp
clang/test/SemaTemplate/destructor-template.cpp
Index: clang/test/SemaTemplate/destructor-template.cpp
===================================================================
--- clang/test/SemaTemplate/destructor-template.cpp
+++ clang/test/SemaTemplate/destructor-template.cpp
@@ -92,3 +92,13 @@
template <class T>
~PR33189() { } // expected-error{{destructor cannot be declared as a template}}
};
+
+namespace PR38671 {
+struct S {
+ template <class>
+ ~S(); // expected-error{{destructor cannot be declared as a template}}
+};
+struct T : S { // expected-note{{destructor of 'T' is implicitly deleted because base class 'PR38671::S' has no destructor}}
+ ~T() = default; // expected-warning{{explicitly defaulted destructor is implicitly deleted}}
+};
+} // namespace PR38671
Index: clang/lib/Sema/SemaLookup.cpp
===================================================================
--- clang/lib/Sema/SemaLookup.cpp
+++ clang/lib/Sema/SemaLookup.cpp
@@ -3112,11 +3112,10 @@
});
}
CXXDestructorDecl *DD = RD->getDestructor();
- assert(DD && "record without a destructor");
Result->setMethod(DD);
- Result->setKind(DD->isDeleted() ?
- SpecialMemberOverloadResult::NoMemberOrDeleted :
- SpecialMemberOverloadResult::Success);
+ Result->setKind(DD && !DD->isDeleted()
+ ? SpecialMemberOverloadResult::Success
+ : SpecialMemberOverloadResult::NoMemberOrDeleted);
return *Result;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69225.228289.patch
Type: text/x-patch
Size: 1465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191107/5774652c/attachment.bin>
More information about the cfe-commits
mailing list