Skip to content

Commit 3533fe7

Browse files
committed
Revert "[clang] Preserve found-decl when constructing VarTemplateIds (#82265)"
This reverts commit 5037350. Broke include-cleaner tests
1 parent 35593f6 commit 3533fe7

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

clang/include/clang/Sema/Sema.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8538,7 +8538,7 @@ class Sema final {
85388538
/// if the arguments are dependent.
85398539
ExprResult CheckVarTemplateId(const CXXScopeSpec &SS,
85408540
const DeclarationNameInfo &NameInfo,
8541-
VarTemplateDecl *Template, NamedDecl *FoundD,
8541+
VarTemplateDecl *Template,
85428542
SourceLocation TemplateLoc,
85438543
const TemplateArgumentListInfo *TemplateArgs);
85448544

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4958,10 +4958,11 @@ Sema::CheckVarTemplateId(VarTemplateDecl *Template, SourceLocation TemplateLoc,
49584958
return Decl;
49594959
}
49604960

4961-
ExprResult Sema::CheckVarTemplateId(
4962-
const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo,
4963-
VarTemplateDecl *Template, NamedDecl *FoundD, SourceLocation TemplateLoc,
4964-
const TemplateArgumentListInfo *TemplateArgs) {
4961+
ExprResult
4962+
Sema::CheckVarTemplateId(const CXXScopeSpec &SS,
4963+
const DeclarationNameInfo &NameInfo,
4964+
VarTemplateDecl *Template, SourceLocation TemplateLoc,
4965+
const TemplateArgumentListInfo *TemplateArgs) {
49654966

49664967
DeclResult Decl = CheckVarTemplateId(Template, TemplateLoc, NameInfo.getLoc(),
49674968
*TemplateArgs);
@@ -4977,7 +4978,8 @@ ExprResult Sema::CheckVarTemplateId(
49774978
NameInfo.getLoc());
49784979

49794980
// Build an ordinary singleton decl ref.
4980-
return BuildDeclarationNameExpr(SS, NameInfo, Var, FoundD, TemplateArgs);
4981+
return BuildDeclarationNameExpr(SS, NameInfo, Var,
4982+
/*FoundD=*/nullptr, TemplateArgs);
49814983
}
49824984

49834985
void Sema::diagnoseMissingTemplateArguments(TemplateName Name,
@@ -5064,9 +5066,9 @@ ExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS,
50645066
bool KnownDependent = false;
50655067
// In C++1y, check variable template ids.
50665068
if (R.getAsSingle<VarTemplateDecl>()) {
5067-
ExprResult Res = CheckVarTemplateId(
5068-
SS, R.getLookupNameInfo(), R.getAsSingle<VarTemplateDecl>(),
5069-
R.getRepresentativeDecl(), TemplateKWLoc, TemplateArgs);
5069+
ExprResult Res = CheckVarTemplateId(SS, R.getLookupNameInfo(),
5070+
R.getAsSingle<VarTemplateDecl>(),
5071+
TemplateKWLoc, TemplateArgs);
50705072
if (Res.isInvalid() || Res.isUsable())
50715073
return Res;
50725074
// Result is dependent. Carry on to build an UnresolvedLookupEpxr.

clang/test/AST/ast-dump-using.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace a {
44
struct S;
5-
template <typename T> T x = {};
65
}
76
namespace b {
87
using a::S;
@@ -22,10 +21,4 @@ typedef S e; // check the same UsingType is reused.
2221
// CHECK-NEXT: `-UsingType [[TYPE_ADDR]] 'a::S' sugar
2322
// CHECK-NEXT: |-UsingShadow [[SHADOW_ADDR]] 'S'
2423
// CHECK-NEXT: `-RecordType {{.*}} 'a::S'
25-
using a::x;
26-
27-
void foo() {
28-
x<int> = 3;
29-
// CHECK: DeclRefExpr {{.*}} 'x' {{.*}} (UsingShadow {{.*}} 'x')
30-
}
3124
}

0 commit comments

Comments
 (0)