@@ -17925,8 +17925,6 @@ static void DoMarkVarDeclReferenced(Sema &SemaRef, SourceLocation Loc,
17925
17925
bool NeedDefinition =
17926
17926
OdrUse == OdrUseContext::Used || NeededForConstantEvaluation;
17927
17927
17928
- VarTemplateSpecializationDecl *VarSpec =
17929
- dyn_cast<VarTemplateSpecializationDecl>(Var);
17930
17928
assert(!isa<VarTemplatePartialSpecializationDecl>(Var) &&
17931
17929
"Can't instantiate a partial template specialization.");
17932
17930
@@ -17961,30 +17959,21 @@ static void DoMarkVarDeclReferenced(Sema &SemaRef, SourceLocation Loc,
17961
17959
Var->setTemplateSpecializationKind(TSK, PointOfInstantiation);
17962
17960
}
17963
17961
17964
- bool InstantiationDependent = false;
17965
- bool IsNonDependent =
17966
- VarSpec ? !TemplateSpecializationType::anyDependentTemplateArguments(
17967
- VarSpec->getTemplateArgsInfo(), InstantiationDependent)
17968
- : true;
17969
-
17970
- // Do not instantiate specializations that are still type-dependent.
17971
- if (IsNonDependent) {
17972
- if (UsableInConstantExpr) {
17973
- // Do not defer instantiations of variables that could be used in a
17974
- // constant expression.
17975
- SemaRef.runWithSufficientStackSpace(PointOfInstantiation, [&] {
17976
- SemaRef.InstantiateVariableDefinition(PointOfInstantiation, Var);
17977
- });
17978
- } else if (FirstInstantiation ||
17979
- isa<VarTemplateSpecializationDecl>(Var)) {
17980
- // FIXME: For a specialization of a variable template, we don't
17981
- // distinguish between "declaration and type implicitly instantiated"
17982
- // and "implicit instantiation of definition requested", so we have
17983
- // no direct way to avoid enqueueing the pending instantiation
17984
- // multiple times.
17985
- SemaRef.PendingInstantiations
17986
- .push_back(std::make_pair(Var, PointOfInstantiation));
17987
- }
17962
+ if (UsableInConstantExpr) {
17963
+ // Do not defer instantiations of variables that could be used in a
17964
+ // constant expression.
17965
+ SemaRef.runWithSufficientStackSpace(PointOfInstantiation, [&] {
17966
+ SemaRef.InstantiateVariableDefinition(PointOfInstantiation, Var);
17967
+ });
17968
+ } else if (FirstInstantiation ||
17969
+ isa<VarTemplateSpecializationDecl>(Var)) {
17970
+ // FIXME: For a specialization of a variable template, we don't
17971
+ // distinguish between "declaration and type implicitly instantiated"
17972
+ // and "implicit instantiation of definition requested", so we have
17973
+ // no direct way to avoid enqueueing the pending instantiation
17974
+ // multiple times.
17975
+ SemaRef.PendingInstantiations
17976
+ .push_back(std::make_pair(Var, PointOfInstantiation));
17988
17977
}
17989
17978
}
17990
17979
}
0 commit comments