[PATCH] D33833: Fix PR 33189: Clang assertion on template destructor declaration
Kuang He via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 6 12:24:40 PDT 2017
kuang_he updated this revision to Diff 101601.
kuang_he added a comment.
Patch updated addressing comment.
https://reviews.llvm.org/D33833
Files:
lib/AST/DeclCXX.cpp
test/SemaCXX/PR33189.cpp
Index: test/SemaCXX/PR33189.cpp
===================================================================
--- /dev/null
+++ test/SemaCXX/PR33189.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
+
+class U
+{
+ template <class T>
+ ~U() { } // expected-error{{destructor cannot be declared as a template}}
+};
Index: lib/AST/DeclCXX.cpp
===================================================================
--- lib/AST/DeclCXX.cpp
+++ lib/AST/DeclCXX.cpp
@@ -1417,11 +1417,8 @@
Context.getCanonicalType(ClassType));
DeclContext::lookup_result R = lookup(Name);
- if (R.empty())
- return nullptr;
- CXXDestructorDecl *Dtor = cast<CXXDestructorDecl>(R.front());
- return Dtor;
+ return R.empty() ? nullptr : dyn_cast<CXXDestructorDecl>(R.front());
}
bool CXXRecordDecl::isAnyDestructorNoReturn() const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33833.101601.patch
Type: text/x-patch
Size: 883 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170606/20146288/attachment.bin>
More information about the cfe-commits
mailing list