hanchenye-llvm-project/clang/lib
Volodymyr Sapsai 9b973483ed [Sema] Fix assertion when constructor is disabled with partially specialized template.
The added test case was triggering assertion

> Assertion failed: (!SpecializedTemplate.is<SpecializedPartialSpecialization*>() && "Already set to a class template partial specialization!"), function setInstantiationOf, file clang/include/clang/AST/DeclTemplate.h, line 1825.

It was happening with ClassTemplateSpecializationDecl
`enable_if_not_same<int, int>`. Because this template is specialized for
equal types not to have a definition, it wasn't instantiated and its
specialization kind remained TSK_Undeclared. And because it was implicit
instantiation, we didn't mark the decl as invalid. So when we try to
find the best matching partial specialization the second time, we hit
the assertion as partial specialization is already set.

Fix by reusing stored partial specialization when available, instead of
looking for the best match every time.

rdar://problem/39524996

Reviewers: rsmith, arphaman

Reviewed By: rsmith

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D46909

llvm-svn: 332509
2018-05-16 18:28:58 +00:00
..
ARCMigrate Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
AST [AST] Added a helper to extract a user-friendly text of a comment. 2018-05-16 12:30:09 +00:00
ASTMatchers Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
Analysis [analyzer] Do not crash on callback for call_once passed by value 2018-05-16 00:29:13 +00:00
Basic [Solaris] Only define _REENTRANT if -pthread 2018-05-15 11:36:00 +00:00
CodeGen [OPENMP] DO not crash on combined constructs in declare target 2018-05-16 15:08:32 +00:00
CrossTU [CrossTU] Fix handling of Cross Translation Unit directory path 2017-10-27 12:53:37 +00:00
Driver [Driver] Only use -lc++ on Fuchsia 2018-05-11 20:42:31 +00:00
Edit Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
Format clang-format: Allow optimizer to break template declaration. 2018-05-16 08:25:03 +00:00
Frontend [Frontend] Avoid running plugins during code completion parse 2018-05-16 13:50:05 +00:00
FrontendTool Make a build bot happy. 2018-02-10 14:26:53 +00:00
Headers [X86] Revert part of r332266: Use __builtin_convertvector to replace some of the avx512 truncate builtins. 2018-05-15 03:17:52 +00:00
Index Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
Lex Reland '[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective' 2018-05-10 19:05:36 +00:00
Parse Improve diagnostics and error recovery for template name lookup. 2018-05-11 02:43:08 +00:00
Rewrite Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
Sema [Sema] Fix assertion when constructor is disabled with partially specialized template. 2018-05-16 18:28:58 +00:00
Serialization Move helper classes into anonymous namespaces. NFCI. 2018-05-15 21:26:47 +00:00
StaticAnalyzer [analyzer] Improve the modeling of memset(). 2018-05-16 12:37:53 +00:00
Tooling [clang] Update uses of DEBUG macro to LLVM_DEBUG. 2018-05-15 13:30:56 +00:00
CMakeLists.txt Add Cross Translation Unit support library 2017-09-22 11:11:01 +00:00