This patch aims to fix the bug reported at https://bugs.llvm.org/show_bug.cgi?id=33189. Clang hits an assertion when a template destructor declaration is present. This is caused by later processing that does not expect to encounter a template when looking at a destructor. The resolution is to treat the destructor as being not declared when later processing is interested in the properties of the destructor of a class.
Details
Diff Detail
Event Timeline
lib/AST/DeclCXX.cpp | ||
---|---|---|
1419–1420 | As it is, return R.empty() ? nullptr : dyn_cast<CXXDestructorDecl>(R.front()); would probably be much more succinct. |
@kuang_he; it is customary to "ping". In this case, "Ping 2".
lib/AST/DeclCXX.cpp | ||
---|---|---|
1421 | I think what is here is probably what we want to do. My understanding is that the code is certainly invalid before we hit this, and the case is so odd that pursuing better recovery is not worthwhile. Do we know if we can recover from getting a FunctionTemplateDecl by some other means? Perhaps by using the result of getTemplatedDecl()? I suspect there may be problems with cases where the noexcept-specifier is dependent. |
test/SemaCXX/PR33189.cpp | ||
---|---|---|
1–7 | Please fold this into an existing test file, perhaps test/SemaTemplate/destructor-template.cpp? |
As it is,
would probably be much more succinct.