[clang] [Clang][Sema] Ensure that the selected candidate for a member function explicit specialization is more constrained than all others (PR #101721)
Krystian Stasiowski via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 5 06:57:41 PDT 2024
================
@@ -7964,8 +7964,9 @@ NamedDecl *Sema::ActOnVariableDeclarator(
D.setRedeclaration(CheckVariableDeclaration(NewVD, Previous));
} else {
// If this is an explicit specialization of a static data member, check it.
- if (IsMemberSpecialization && !IsVariableTemplateSpecialization &&
- !NewVD->isInvalidDecl() && CheckMemberSpecialization(NewVD, Previous))
+ if (IsMemberSpecialization && !IsVariableTemplate &&
+ !IsVariableTemplateSpecialization && !NewVD->isInvalidDecl() &&
+ CheckMemberSpecialization(NewVD, Previous))
----------------
sdkrystian wrote:
> Hm, do we not want to do these checks for an explicit specialization of a member template? Or do we also do those checks somewhere else?
`CheckMemberSpecialization` only handles explicit specializations of non-template members specialized for an implicit instantiation of a class template.
Explicit specializations of _member templates_ specialized for an implicit instantiation of a class template are handled on the same codepath as normal templates, and we set the correct "instantiated from" template there.
https://github.com/llvm/llvm-project/pull/101721
More information about the cfe-commits
mailing list