Skip to content

Commit ee94bd2

Browse files
authored
Revert "[Clang][Sema] Fix crash when using name of UnresolvedUsingValueDecl with template arguments (#83842)" (#84457)
This reverts commit a642eb8 (see #83842)
1 parent 005e182 commit ee94bd2

File tree

4 files changed

+5
-42
lines changed

4 files changed

+5
-42
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,6 @@ Bug Fixes to C++ Support
332332
our attention by an attempt to fix in (#GH77703). Fixes (#GH83385).
333333
- Fix evaluation of some immediate calls in default arguments.
334334
Fixes (#GH80630)
335-
- Fix a crash when an explicit template argument list is used with a name for which lookup
336-
finds a non-template function and a dependent using declarator.
337335
- Fixed an issue where the ``RequiresExprBody`` was involved in the lambda dependency
338336
calculation. (#GH56556), (#GH82849).
339337
- Fix a bug where overload resolution falsely reported an ambiguity when it was comparing

clang/lib/Sema/SemaDecl.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,9 +1110,7 @@ Sema::NameClassification Sema::ClassifyName(Scope *S, CXXScopeSpec &SS,
11101110
// unqualified-id followed by a < and name lookup finds either one
11111111
// or more functions or finds nothing.
11121112
if (!IsFilteredTemplateName)
1113-
FilterAcceptableTemplateNames(Result,
1114-
/*AllowFunctionTemplates=*/true,
1115-
/*AllowDependent=*/true);
1113+
FilterAcceptableTemplateNames(Result);
11161114

11171115
bool IsFunctionTemplate;
11181116
bool IsVarTemplate;
@@ -1122,7 +1120,6 @@ Sema::NameClassification Sema::ClassifyName(Scope *S, CXXScopeSpec &SS,
11221120
Template = Context.getOverloadedTemplateName(Result.begin(),
11231121
Result.end());
11241122
} else if (!Result.empty()) {
1125-
assert(!Result.isUnresolvableResult());
11261123
auto *TD = cast<TemplateDecl>(getAsTemplateNameDecl(
11271124
*Result.begin(), /*AllowFunctionTemplates=*/true,
11281125
/*AllowDependent=*/false));

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -491,20 +491,18 @@ bool Sema::LookupTemplateName(LookupResult &Found,
491491
// To keep our behavior consistent, we apply the "finds nothing" part in
492492
// all language modes, and diagnose the empty lookup in ActOnCallExpr if we
493493
// successfully form a call to an undeclared template-id.
494-
bool AnyFunctions =
495-
getLangOpts().CPlusPlus20 && llvm::any_of(Found, [](NamedDecl *ND) {
494+
bool AllFunctions =
495+
getLangOpts().CPlusPlus20 && llvm::all_of(Found, [](NamedDecl *ND) {
496496
return isa<FunctionDecl>(ND->getUnderlyingDecl());
497497
});
498-
if (AnyFunctions || (Found.empty() && !IsDependent)) {
498+
if (AllFunctions || (Found.empty() && !IsDependent)) {
499499
// If lookup found any functions, or if this is a name that can only be
500500
// used for a function, then strongly assume this is a function
501501
// template-id.
502502
*ATK = (Found.empty() && Found.getLookupName().isIdentifier())
503503
? AssumedTemplateKind::FoundNothing
504504
: AssumedTemplateKind::FoundFunctions;
505-
FilterAcceptableTemplateNames(Found,
506-
/*AllowFunctionTemplates*/ true,
507-
/*AllowDependent*/ true);
505+
Found.clear();
508506
return false;
509507
}
510508
}

clang/test/SemaTemplate/unqual-unresolved-using-value.cpp

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)