Skip to content

Commit 26c762d

Browse files
committed
Revert "[Concepts] Fix incorrect control flow when TryAnnotateTypeConstraint annotates an invalid template-id"
We're not planning more release candidates for 10.0.0 at the moment, so reverting for now. This reverts commit 135744c.
1 parent 135744c commit 26c762d

File tree

7 files changed

+10
-25
lines changed

7 files changed

+10
-25
lines changed

clang/include/clang/Sema/Sema.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6885,8 +6885,7 @@ class Sema final {
68856885
QualType ObjectType, bool EnteringContext,
68866886
bool &MemberOfUnknownSpecialization,
68876887
SourceLocation TemplateKWLoc = SourceLocation(),
6888-
AssumedTemplateKind *ATK = nullptr,
6889-
bool Disambiguation = false);
6888+
AssumedTemplateKind *ATK = nullptr);
68906889

68916890
TemplateNameKind isTemplateName(Scope *S,
68926891
CXXScopeSpec &SS,
@@ -6895,8 +6894,7 @@ class Sema final {
68956894
ParsedType ObjectType,
68966895
bool EnteringContext,
68976896
TemplateTy &Template,
6898-
bool &MemberOfUnknownSpecialization,
6899-
bool Disambiguation = false);
6897+
bool &MemberOfUnknownSpecialization);
69006898

69016899
/// Try to resolve an undeclared template name as a type template.
69026900
///

clang/lib/Parse/ParseDecl.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3252,9 +3252,6 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
32523252
goto DoneWithDeclSpec;
32533253
if (isTypeConstraintAnnotation())
32543254
continue;
3255-
if (NextToken().is(tok::annot_template_id))
3256-
// Might have been annotated by TryAnnotateTypeConstraint.
3257-
continue;
32583255
// Eat the scope spec so the identifier is current.
32593256
ConsumeAnnotationToken();
32603257
ParsedAttributesWithRange Attrs(AttrFactory);
@@ -3408,9 +3405,6 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
34083405
goto DoneWithDeclSpec;
34093406
if (isTypeConstraintAnnotation())
34103407
continue;
3411-
if (Tok.is(tok::annot_template_id))
3412-
// Might have been annotated by TryAnnotateTypeConstraint.
3413-
continue;
34143408
ParsedAttributesWithRange Attrs(AttrFactory);
34153409
if (ParseImplicitInt(DS, nullptr, TemplateInfo, AS, DSContext, Attrs)) {
34163410
if (!Attrs.empty()) {

clang/lib/Parse/ParseTemplate.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,7 @@ bool Parser::TryAnnotateTypeConstraint() {
710710
/*ObjectType=*/ParsedType(),
711711
/*EnteringContext=*/false,
712712
PossibleConcept,
713-
MemberOfUnknownSpecialization,
714-
/*Disambiguation=*/true);
713+
MemberOfUnknownSpecialization);
715714
if (MemberOfUnknownSpecialization || !PossibleConcept ||
716715
TNK != TNK_Concept_template) {
717716
if (SS.isNotEmpty())

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ TemplateNameKind Sema::isTemplateName(Scope *S,
174174
ParsedType ObjectTypePtr,
175175
bool EnteringContext,
176176
TemplateTy &TemplateResult,
177-
bool &MemberOfUnknownSpecialization,
178-
bool Disambiguation) {
177+
bool &MemberOfUnknownSpecialization) {
179178
assert(getLangOpts().CPlusPlus && "No template names in C!");
180179

181180
DeclarationName TName;
@@ -205,7 +204,7 @@ TemplateNameKind Sema::isTemplateName(Scope *S,
205204
LookupResult R(*this, TName, Name.getBeginLoc(), LookupOrdinaryName);
206205
if (LookupTemplateName(R, S, SS, ObjectType, EnteringContext,
207206
MemberOfUnknownSpecialization, SourceLocation(),
208-
&AssumedTemplate, Disambiguation))
207+
&AssumedTemplate))
209208
return TNK_Non_template;
210209

211210
if (AssumedTemplate != AssumedTemplateKind::None) {
@@ -372,8 +371,7 @@ bool Sema::LookupTemplateName(LookupResult &Found,
372371
bool EnteringContext,
373372
bool &MemberOfUnknownSpecialization,
374373
SourceLocation TemplateKWLoc,
375-
AssumedTemplateKind *ATK,
376-
bool Disambiguation) {
374+
AssumedTemplateKind *ATK) {
377375
if (ATK)
378376
*ATK = AssumedTemplateKind::None;
379377

@@ -496,9 +494,8 @@ bool Sema::LookupTemplateName(LookupResult &Found,
496494
}
497495
}
498496

499-
if (Found.empty() && !IsDependent && !Disambiguation) {
500-
// If we did not find any names, and this is not a disambiguation, attempt
501-
// to correct any typos.
497+
if (Found.empty() && !IsDependent) {
498+
// If we did not find any names, attempt to correct any typos.
502499
DeclarationName Name = Found.getLookupName();
503500
Found.clear();
504501
// Simple filter callback that, for keywords, only accepts the C++ *_cast

clang/test/SemaCXX/invalid-member-expr.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// RUN: %clang_cc1 -fsyntax-only -verify %s
22
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
33
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
4-
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
54

65
class X {};
76

clang/test/SemaCXX/typo-correction.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %clang_cc1 -fspell-checking-limit 0 -verify -Wno-c++11-extensions %s
2-
// RUN: %clang_cc1 -fspell-checking-limit 0 -verify -Wno-c++11-extensions -std=c++20 %s
32

43
namespace PR21817{
54
int a(-rsing[2]); // expected-error {{undeclared identifier 'rsing'; did you mean 'using'?}}
@@ -524,8 +523,8 @@ PR18685::BitVector Map; // expected-error-re {{no type named 'BitVector' in nam
524523
namespace shadowed_template {
525524
template <typename T> class Fizbin {}; // expected-note {{'::shadowed_template::Fizbin' declared here}}
526525
class Baz {
527-
int Fizbin;
528-
Fizbin<int> qux; // expected-error {{no template named 'Fizbin'; did you mean '::shadowed_template::Fizbin'?}}
526+
int Fizbin();
527+
Fizbin<int> qux; // expected-error {{no template named 'Fizbin'; did you mean '::shadowed_template::Fizbin'?}}
529528
};
530529
}
531530

clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++1y -fms-compatibility -fno-spell-checking -fsyntax-only -verify %s
2-
// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++20 -fms-compatibility -fno-spell-checking -fsyntax-only -verify %s
32

43

54
template <class T>

0 commit comments

Comments
 (0)