@@ -6108,7 +6108,7 @@ NamedDecl *Sema::ActOnVariableDeclarator(
6108
6108
}
6109
6109
}
6110
6110
6111
- bool IsExplicitSpecialization = false;
6111
+ bool IsMemberSpecialization = false;
6112
6112
bool IsVariableTemplateSpecialization = false;
6113
6113
bool IsPartialSpecialization = false;
6114
6114
bool IsVariableTemplate = false;
@@ -6186,7 +6186,7 @@ NamedDecl *Sema::ActOnVariableDeclarator(
6186
6186
? D.getName().TemplateId
6187
6187
: nullptr,
6188
6188
TemplateParamLists,
6189
- /*never a friend*/ false, IsExplicitSpecialization , Invalid);
6189
+ /*never a friend*/ false, IsMemberSpecialization , Invalid);
6190
6190
6191
6191
if (TemplateParams) {
6192
6192
if (!TemplateParams->size() &&
@@ -6412,7 +6412,7 @@ NamedDecl *Sema::ActOnVariableDeclarator(
6412
6412
<< (IsPartialSpecialization ? 1 : 0)
6413
6413
<< FixItHint::CreateRemoval(
6414
6414
D.getDeclSpec().getModulePrivateSpecLoc());
6415
- else if (IsExplicitSpecialization )
6415
+ else if (IsMemberSpecialization )
6416
6416
Diag(NewVD->getLocation(), diag::err_module_private_specialization)
6417
6417
<< 2
6418
6418
<< FixItHint::CreateRemoval(D.getDeclSpec().getModulePrivateSpecLoc());
@@ -6527,7 +6527,7 @@ NamedDecl *Sema::ActOnVariableDeclarator(
6527
6527
// declaration has linkage).
6528
6528
FilterLookupForScope(Previous, OriginalDC, S, shouldConsiderLinkage(NewVD),
6529
6529
D.getCXXScopeSpec().isNotEmpty() ||
6530
- IsExplicitSpecialization ||
6530
+ IsMemberSpecialization ||
6531
6531
IsVariableTemplateSpecialization);
6532
6532
6533
6533
// Check whether the previous declaration is in the same block scope. This
@@ -6542,7 +6542,7 @@ NamedDecl *Sema::ActOnVariableDeclarator(
6542
6542
D.setRedeclaration(CheckVariableDeclaration(NewVD, Previous));
6543
6543
} else {
6544
6544
// If this is an explicit specialization of a static data member, check it.
6545
- if (IsExplicitSpecialization && !NewVD->isInvalidDecl() &&
6545
+ if (IsMemberSpecialization && !NewVD->isInvalidDecl() &&
6546
6546
CheckMemberSpecialization(NewVD, Previous))
6547
6547
NewVD->setInvalidDecl();
6548
6548
@@ -6657,7 +6657,7 @@ NamedDecl *Sema::ActOnVariableDeclarator(
6657
6657
if (D.isRedeclaration() && !Previous.empty()) {
6658
6658
checkDLLAttributeRedeclaration(
6659
6659
*this, dyn_cast<NamedDecl>(Previous.getRepresentativeDecl()), NewVD,
6660
- IsExplicitSpecialization , D.isFunctionDefinition());
6660
+ IsMemberSpecialization , D.isFunctionDefinition());
6661
6661
}
6662
6662
6663
6663
if (NewTemplate) {
@@ -7936,7 +7936,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
7936
7936
7937
7937
bool isFriend = false;
7938
7938
FunctionTemplateDecl *FunctionTemplate = nullptr;
7939
- bool isExplicitSpecialization = false;
7939
+ bool isMemberSpecialization = false;
7940
7940
bool isFunctionTemplateSpecialization = false;
7941
7941
7942
7942
bool isDependentClassScopeExplicitSpecialization = false;
@@ -7992,7 +7992,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
7992
7992
}
7993
7993
7994
7994
SetNestedNameSpecifier(NewFD, D);
7995
- isExplicitSpecialization = false;
7995
+ isMemberSpecialization = false;
7996
7996
isFunctionTemplateSpecialization = false;
7997
7997
if (D.isInvalidType())
7998
7998
NewFD->setInvalidDecl();
@@ -8007,7 +8007,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
8007
8007
D.getName().getKind() == UnqualifiedId::IK_TemplateId
8008
8008
? D.getName().TemplateId
8009
8009
: nullptr,
8010
- TemplateParamLists, isFriend, isExplicitSpecialization ,
8010
+ TemplateParamLists, isFriend, isMemberSpecialization ,
8011
8011
Invalid)) {
8012
8012
if (TemplateParams->size() > 0) {
8013
8013
// This is a function template
@@ -8340,7 +8340,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
8340
8340
// Filter out previous declarations that don't match the scope.
8341
8341
FilterLookupForScope(Previous, OriginalDC, S, shouldConsiderLinkage(NewFD),
8342
8342
D.getCXXScopeSpec().isNotEmpty() ||
8343
- isExplicitSpecialization ||
8343
+ isMemberSpecialization ||
8344
8344
isFunctionTemplateSpecialization);
8345
8345
8346
8346
// Handle GNU asm-label extension (encoded as an attribute).
@@ -8490,7 +8490,6 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
8490
8490
8491
8491
if (!getLangOpts().CPlusPlus) {
8492
8492
// Perform semantic checking on the function declaration.
8493
- bool isExplicitSpecialization=false;
8494
8493
if (!NewFD->isInvalidDecl() && NewFD->isMain())
8495
8494
CheckMain(NewFD, D.getDeclSpec());
8496
8495
@@ -8499,7 +8498,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
8499
8498
8500
8499
if (!NewFD->isInvalidDecl())
8501
8500
D.setRedeclaration(CheckFunctionDeclaration(S, NewFD, Previous,
8502
- isExplicitSpecialization ));
8501
+ isMemberSpecialization ));
8503
8502
else if (!Previous.empty())
8504
8503
// Recover gracefully from an invalid redeclaration.
8505
8504
D.setRedeclaration(true);
@@ -8634,7 +8633,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
8634
8633
<< FixItHint::CreateRemoval(
8635
8634
D.getDeclSpec().getStorageClassSpecLoc());
8636
8635
}
8637
- } else if (isExplicitSpecialization && isa<CXXMethodDecl>(NewFD)) {
8636
+ } else if (isMemberSpecialization && isa<CXXMethodDecl>(NewFD)) {
8638
8637
if (CheckMemberSpecialization(NewFD, Previous))
8639
8638
NewFD->setInvalidDecl();
8640
8639
}
@@ -8649,7 +8648,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
8649
8648
8650
8649
if (!NewFD->isInvalidDecl())
8651
8650
D.setRedeclaration(CheckFunctionDeclaration(S, NewFD, Previous,
8652
- isExplicitSpecialization ));
8651
+ isMemberSpecialization ));
8653
8652
else if (!Previous.empty())
8654
8653
// Recover gracefully from an invalid redeclaration.
8655
8654
D.setRedeclaration(true);
@@ -8755,7 +8754,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
8755
8754
} else if (!D.isFunctionDefinition() &&
8756
8755
isa<CXXMethodDecl>(NewFD) && NewFD->isOutOfLine() &&
8757
8756
!isFriend && !isFunctionTemplateSpecialization &&
8758
- !isExplicitSpecialization ) {
8757
+ !isMemberSpecialization ) {
8759
8758
// An out-of-line member function declaration must also be a
8760
8759
// definition (C++ [class.mfct]p2).
8761
8760
// Note that this is not the case for explicit specializations of
@@ -8816,7 +8815,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
8816
8815
if (D.isRedeclaration() && !Previous.empty()) {
8817
8816
checkDLLAttributeRedeclaration(
8818
8817
*this, dyn_cast<NamedDecl>(Previous.getRepresentativeDecl()), NewFD,
8819
- isExplicitSpecialization || isFunctionTemplateSpecialization,
8818
+ isMemberSpecialization || isFunctionTemplateSpecialization,
8820
8819
D.isFunctionDefinition());
8821
8820
}
8822
8821
@@ -8941,15 +8940,16 @@ bool Sema::shouldLinkDependentDeclWithPrevious(Decl *D, Decl *PrevDecl) {
8941
8940
/// that have been instantiated via C++ template instantiation (called
8942
8941
/// via InstantiateDecl).
8943
8942
///
8944
- /// \param IsExplicitSpecialization whether this new function declaration is
8945
- /// an explicit specialization of the previous declaration.
8943
+ /// \param IsMemberSpecialization whether this new function declaration is
8944
+ /// a member specialization (that replaces any definition provided by the
8945
+ /// previous declaration).
8946
8946
///
8947
8947
/// This sets NewFD->isInvalidDecl() to true if there was an error.
8948
8948
///
8949
8949
/// \returns true if the function declaration is a redeclaration.
8950
8950
bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD,
8951
8951
LookupResult &Previous,
8952
- bool IsExplicitSpecialization ) {
8952
+ bool IsMemberSpecialization ) {
8953
8953
assert(!NewFD->getReturnType()->isVariablyModifiedType() &&
8954
8954
"Variably modified return types are not handled here");
8955
8955
@@ -9099,7 +9099,7 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD,
9099
9099
9100
9100
// If this is an explicit specialization of a member that is a function
9101
9101
// template, mark it as a member specialization.
9102
- if (IsExplicitSpecialization &&
9102
+ if (IsMemberSpecialization &&
9103
9103
NewTemplateDecl->getInstantiatedFromMemberTemplate()) {
9104
9104
NewTemplateDecl->setMemberSpecialization();
9105
9105
assert(OldTemplateDecl->isMemberSpecialization());
@@ -12843,8 +12843,8 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
12843
12843
TagTypeKind Kind = TypeWithKeyword::getTagTypeKindForTypeSpec(TagSpec);
12844
12844
bool ScopedEnum = ScopedEnumKWLoc.isValid();
12845
12845
12846
- // FIXME: Check explicit specializations more carefully.
12847
- bool isExplicitSpecialization = false;
12846
+ // FIXME: Check member specializations more carefully.
12847
+ bool isMemberSpecialization = false;
12848
12848
bool Invalid = false;
12849
12849
12850
12850
// We only need to do this matching if we have template parameters
@@ -12855,7 +12855,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
12855
12855
if (TemplateParameterList *TemplateParams =
12856
12856
MatchTemplateParametersToScopeSpecifier(
12857
12857
KWLoc, NameLoc, SS, nullptr, TemplateParameterLists,
12858
- TUK == TUK_Friend, isExplicitSpecialization , Invalid)) {
12858
+ TUK == TUK_Friend, isMemberSpecialization , Invalid)) {
12859
12859
if (Kind == TTK_Enum) {
12860
12860
Diag(KWLoc, diag::err_enum_template);
12861
12861
return nullptr;
@@ -12882,7 +12882,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
12882
12882
// The "template<>" header is extraneous.
12883
12883
Diag(TemplateParams->getTemplateLoc(), diag::err_template_tag_noparams)
12884
12884
<< TypeWithKeyword::getTagTypeKindName(Kind) << Name;
12885
- isExplicitSpecialization = true;
12885
+ isMemberSpecialization = true;
12886
12886
}
12887
12887
}
12888
12888
}
@@ -13202,7 +13202,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
13202
13202
if (auto *Shadow = dyn_cast<UsingShadowDecl>(DirectPrevDecl)) {
13203
13203
auto *OldTag = dyn_cast<TagDecl>(PrevDecl);
13204
13204
if (SS.isEmpty() && TUK != TUK_Reference && TUK != TUK_Friend &&
13205
- isDeclInScope(Shadow, SearchDC, S, isExplicitSpecialization ) &&
13205
+ isDeclInScope(Shadow, SearchDC, S, isMemberSpecialization ) &&
13206
13206
!(OldTag && isAcceptableTagRedeclContext(
13207
13207
*this, OldTag->getDeclContext(), SearchDC))) {
13208
13208
Diag(KWLoc, diag::err_using_decl_conflict_reverse);
@@ -13222,7 +13222,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
13222
13222
// rementions the tag), reuse the decl.
13223
13223
if (TUK == TUK_Reference || TUK == TUK_Friend ||
13224
13224
isDeclInScope(DirectPrevDecl, SearchDC, S,
13225
- SS.isNotEmpty() || isExplicitSpecialization )) {
13225
+ SS.isNotEmpty() || isMemberSpecialization )) {
13226
13226
// Make sure that this wasn't declared as an enum and now used as a
13227
13227
// struct or something similar.
13228
13228
if (!isAcceptableTagRedeclaration(PrevTagDecl, Kind,
@@ -13327,7 +13327,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
13327
13327
// is from an implicit instantiation, don't emit an error
13328
13328
// here; we'll catch this in the general case below.
13329
13329
bool IsExplicitSpecializationAfterInstantiation = false;
13330
- if (isExplicitSpecialization ) {
13330
+ if (isMemberSpecialization ) {
13331
13331
if (CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(Def))
13332
13332
IsExplicitSpecializationAfterInstantiation =
13333
13333
RD->getTemplateSpecializationKind() !=
@@ -13421,7 +13421,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
13421
13421
13422
13422
// Otherwise, only diagnose if the declaration is in scope.
13423
13423
} else if (!isDeclInScope(DirectPrevDecl, SearchDC, S,
13424
- SS.isNotEmpty() || isExplicitSpecialization )) {
13424
+ SS.isNotEmpty() || isMemberSpecialization )) {
13425
13425
// do nothing
13426
13426
13427
13427
// Diagnose implicit declarations introduced by elaborated types.
@@ -13553,7 +13553,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
13553
13553
// for explicit specializations, because they have similar checking
13554
13554
// (with more specific diagnostics) in the call to
13555
13555
// CheckMemberSpecialization, below.
13556
- if (!isExplicitSpecialization &&
13556
+ if (!isMemberSpecialization &&
13557
13557
(TUK == TUK_Definition || TUK == TUK_Declaration) &&
13558
13558
diagnoseQualifiedDeclaration(SS, DC, OrigName, Loc))
13559
13559
Invalid = true;
@@ -13584,7 +13584,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
13584
13584
}
13585
13585
13586
13586
if (ModulePrivateLoc.isValid()) {
13587
- if (isExplicitSpecialization )
13587
+ if (isMemberSpecialization )
13588
13588
Diag(New->getLocation(), diag::err_module_private_specialization)
13589
13589
<< 2
13590
13590
<< FixItHint::CreateRemoval(ModulePrivateLoc);
@@ -13597,7 +13597,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
13597
13597
13598
13598
// If this is a specialization of a member class (of a class template),
13599
13599
// check the specialization.
13600
- if (isExplicitSpecialization && CheckMemberSpecialization(New, Previous))
13600
+ if (isMemberSpecialization && CheckMemberSpecialization(New, Previous))
13601
13601
Invalid = true;
13602
13602
13603
13603
// If we're declaring or defining a tag in function prototype scope in C,
0 commit comments