Skip to content

Commit 27e1620

Browse files
zygoloidmemfrob
authored andcommitted
More cleanup after removing the ability to reference a dependent
VarTemplateSpecializationDecl.
1 parent 932c500 commit 27e1620

File tree

1 file changed

+15
-26
lines changed

1 file changed

+15
-26
lines changed

clang/lib/Sema/SemaExpr.cpp

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17925,8 +17925,6 @@ static void DoMarkVarDeclReferenced(Sema &SemaRef, SourceLocation Loc,
1792517925
bool NeedDefinition =
1792617926
OdrUse == OdrUseContext::Used || NeededForConstantEvaluation;
1792717927

17928-
VarTemplateSpecializationDecl *VarSpec =
17929-
dyn_cast<VarTemplateSpecializationDecl>(Var);
1793017928
assert(!isa<VarTemplatePartialSpecializationDecl>(Var) &&
1793117929
"Can't instantiate a partial template specialization.");
1793217930

@@ -17961,30 +17959,21 @@ static void DoMarkVarDeclReferenced(Sema &SemaRef, SourceLocation Loc,
1796117959
Var->setTemplateSpecializationKind(TSK, PointOfInstantiation);
1796217960
}
1796317961

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));
1798817977
}
1798917978
}
1799017979
}

0 commit comments

Comments
 (0)