hanchenye-llvm-project/clang
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
..
INPUTS
bindings implementing Cursor.get_included_file in python bindings 2018-05-10 21:39:29 +00:00
cmake Set CMAKE_BUILD_WITH_INSTALL_RPATH for Fuchsia runtimes 2018-05-09 00:58:12 +00:00
docs [diagtool] Add diagtool to install target. 2018-05-16 10:23:25 +00:00
examples s/LLVM_ON_WIN32/_WIN32/, clang 2018-04-27 19:11:14 +00:00
include [Attr] Don't print fake MSInheritance argument 2018-05-16 15:18:30 +00:00
lib [Sema] Fix assertion when constructor is disabled with partially specialized template. 2018-05-16 18:28:58 +00:00
runtime
test [Sema] Fix assertion when constructor is disabled with partially specialized template. 2018-05-16 18:28:58 +00:00
tools [diagtool] Add diagtool to install target. 2018-05-16 10:23:25 +00:00
unittests [AST] Added a helper to extract a user-friendly text of a comment. 2018-05-16 12:30:09 +00:00
utils Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
www
.arcconfig
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
INSTALL.txt
LICENSE.TXT
ModuleInfo.txt
NOTES.txt
README.txt

README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source-level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:             http://clang.llvm.org/
Building and using Clang:         http://clang.llvm.org/get_started.html
Clang Static Analyzer:            http://clang-analyzer.llvm.org/
Information on the LLVM project:  http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang development mailing list:
  http://lists.llvm.org/mailman/listinfo/cfe-dev

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/