]> granicus.if.org Git - clang/commit
Fix PR28100 - Allow redeclarations of deleted explicit specializations.
authorFaisal Vali <faisalv@yahoo.com>
Tue, 14 Jun 2016 03:23:15 +0000 (03:23 +0000)
committerFaisal Vali <faisalv@yahoo.com>
Tue, 14 Jun 2016 03:23:15 +0000 (03:23 +0000)
commit76841341d9fc4ca7d559f41e1a85ebff19869ebb
tree76dcba6358e63d927c7c72f0865e17ed4dd7358a
parent31c234b9556ce386d481ff3838baacfc64de619c
Fix PR28100 - Allow redeclarations of deleted explicit specializations.

See https://llvm.org/bugs/show_bug.cgi?id=28100.

In r266561 when I implemented allowing explicit specializations of function templates to override deleted status, I mistakenly assumed (and hence introduced a violable assertion) that when an explicit specialization was being declared, the corresponding specialization of the most specialized function template that it would get linked to would always be the one that was implicitly generated - and so if it was marked as 'deleted' it must have inherited it from the primary template and so should be safe to reset its deleted status, and set it to being an explicit specialization.  Obviously during redeclaration of a deleted explicit specialization, in order to avoid a recursive reset, we need to check that the previous specialization is not an explicit specialization (instead of assuming and asserting it) and that it hasn't been referenced, and so only then is it safe to reset its 'deleted' status.

All regression tests pass.

Thanks to Zhendong Su for reporting the bug and David Majnemer for tracking it to my commit r266561, and promptly bringing it to my attention.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272631 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaTemplate.cpp
test/SemaCXX/delete-and-function-templates.cpp