/// template<int Value> struct integer_c;
/// X<integer_c> xic;
/// \endcode
- TPL_TemplateTemplateArgumentMatch
+ TPL_TemplateTemplateArgumentMatch,
+
+ /// We are determining whether the template-parameters are equivalent
+ /// according to C++ [temp.over.link]/6. This comparison does not consider
+ /// constraints.
+ ///
+ /// \code
+ /// template<C1 T> void f(T);
+ /// template<C2 T> void f(T);
+ /// \endcode
+ TPL_TemplateParamsEquivalent,
};
bool TemplateParameterListsAreEqual(
const NamedDecl *NewInstFrom, TemplateParameterList *New,
const NamedDecl *OldInstFrom, TemplateParameterList *Old, bool Complain,
TemplateParameterListEqualKind Kind,
- SourceLocation TemplateArgLoc = SourceLocation(),
- bool PartialOrdering = false);
+ SourceLocation TemplateArgLoc = SourceLocation());
bool TemplateParameterListsAreEqual(
TemplateParameterList *New, TemplateParameterList *Old, bool Complain,
TemplateParameterListEqualKind Kind,
- SourceLocation TemplateArgLoc = SourceLocation(),
- bool PartialOrdering = false) {
+ SourceLocation TemplateArgLoc = SourceLocation()) {
return TemplateParameterListsAreEqual(nullptr, New, nullptr, Old, Complain,
- Kind, TemplateArgLoc,
- PartialOrdering);
+ Kind, TemplateArgLoc);
}
bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams);
static bool MatchTemplateParameterKind(
Sema &S, NamedDecl *New, const NamedDecl *NewInstFrom, NamedDecl *Old,
const NamedDecl *OldInstFrom, bool Complain,
- Sema::TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc,
- bool PartialOrdering) {
+ Sema::TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc) {
// Check the actual kind (type, non-type, template).
if (Old->getKind() != New->getKind()) {
if (Complain) {
(Kind == Sema::TPL_TemplateMatch
? Sema::TPL_TemplateTemplateParmMatch
: Kind),
- TemplateArgLoc, PartialOrdering))
+ TemplateArgLoc))
return false;
}
- if (!PartialOrdering && Kind != Sema::TPL_TemplateTemplateArgumentMatch &&
+ if (Kind != Sema::TPL_TemplateParamsEquivalent &&
+ Kind != Sema::TPL_TemplateTemplateArgumentMatch &&
!isa<TemplateTemplateParmDecl>(Old)) {
const Expr *NewC = nullptr, *OldC = nullptr;
bool Sema::TemplateParameterListsAreEqual(
const NamedDecl *NewInstFrom, TemplateParameterList *New,
const NamedDecl *OldInstFrom, TemplateParameterList *Old, bool Complain,
- TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc,
- bool PartialOrdering) {
+ TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc) {
if (Old->size() != New->size() && Kind != TPL_TemplateTemplateArgumentMatch) {
if (Complain)
DiagnoseTemplateParameterListArityMismatch(*this, New, Old, Kind,
if (!MatchTemplateParameterKind(*this, *NewParm, NewInstFrom, *OldParm,
OldInstFrom, Complain, Kind,
- TemplateArgLoc, PartialOrdering))
+ TemplateArgLoc))
return false;
++NewParm;
for (; NewParm != NewParmEnd; ++NewParm) {
if (!MatchTemplateParameterKind(*this, *NewParm, NewInstFrom, *OldParm,
OldInstFrom, Complain, Kind,
- TemplateArgLoc, PartialOrdering))
+ TemplateArgLoc))
return false;
}
}
return false;
}
- if (!PartialOrdering && Kind != TPL_TemplateTemplateArgumentMatch) {
+ if (Kind != TPL_TemplateTemplateArgumentMatch &&
+ Kind != TPL_TemplateParamsEquivalent) {
const Expr *NewRC = New->getRequiresClause();
const Expr *OldRC = Old->getRequiresClause();
// function parameters that positionally correspond between the two
// templates are not of the same type, neither template is more specialized
// than the other.
- if (!TemplateParameterListsAreEqual(
- TPL1, TPL2, false, Sema::TPL_TemplateMatch, SourceLocation(), true))
+ if (!TemplateParameterListsAreEqual(TPL1, TPL2, false,
+ Sema::TPL_TemplateParamsEquivalent))
return nullptr;
for (unsigned i = 0; i < NumParams1; ++i)
// function parameters that positionally correspond between the two
// templates are not of the same type, neither template is more specialized
// than the other.
- if (!S.TemplateParameterListsAreEqual(
- TPL1, TPL2, false, Sema::TPL_TemplateMatch, SourceLocation(), true))
+ if (!S.TemplateParameterListsAreEqual(TPL1, TPL2, false,
+ Sema::TPL_TemplateParamsEquivalent))
return nullptr;
if (!TemplateArgumentListAreEqual(S.getASTContext())(P1, P2))