Commit 26c762df authored by Hans Wennborg's avatar Hans Wennborg
Browse files

Revert "[Concepts] Fix incorrect control flow when TryAnnotateTypeConstraint...

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 135744ce.
parent 135744ce
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -6885,8 +6885,7 @@ public:
                          QualType ObjectType, bool EnteringContext,
                          bool &MemberOfUnknownSpecialization,
                          SourceLocation TemplateKWLoc = SourceLocation(),
                          AssumedTemplateKind *ATK = nullptr,
                          bool Disambiguation = false);
                          AssumedTemplateKind *ATK = nullptr);
  TemplateNameKind isTemplateName(Scope *S,
                                  CXXScopeSpec &SS,
@@ -6895,8 +6894,7 @@ public:
                                  ParsedType ObjectType,
                                  bool EnteringContext,
                                  TemplateTy &Template,
                                  bool &MemberOfUnknownSpecialization,
                                  bool Disambiguation = false);
                                  bool &MemberOfUnknownSpecialization);
  /// Try to resolve an undeclared template name as a type template.
  ///
+0 −6
Original line number Diff line number Diff line
@@ -3252,9 +3252,6 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
          goto DoneWithDeclSpec;
        if (isTypeConstraintAnnotation())
          continue;
        if (NextToken().is(tok::annot_template_id))
          // Might have been annotated by TryAnnotateTypeConstraint.
          continue;
        // Eat the scope spec so the identifier is current.
        ConsumeAnnotationToken();
        ParsedAttributesWithRange Attrs(AttrFactory);
@@ -3408,9 +3405,6 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
          goto DoneWithDeclSpec;
        if (isTypeConstraintAnnotation())
          continue;
        if (Tok.is(tok::annot_template_id))
          // Might have been annotated by TryAnnotateTypeConstraint.
          continue;
        ParsedAttributesWithRange Attrs(AttrFactory);
        if (ParseImplicitInt(DS, nullptr, TemplateInfo, AS, DSContext, Attrs)) {
          if (!Attrs.empty()) {
+1 −2
Original line number Diff line number Diff line
@@ -710,8 +710,7 @@ bool Parser::TryAnnotateTypeConstraint() {
                                      /*ObjectType=*/ParsedType(),
                                      /*EnteringContext=*/false,
                                      PossibleConcept,
                                      MemberOfUnknownSpecialization,
                                      /*Disambiguation=*/true);
                                      MemberOfUnknownSpecialization);
    if (MemberOfUnknownSpecialization || !PossibleConcept ||
        TNK != TNK_Concept_template) {
      if (SS.isNotEmpty())
+5 −8
Original line number Diff line number Diff line
@@ -174,8 +174,7 @@ TemplateNameKind Sema::isTemplateName(Scope *S,
                                      ParsedType ObjectTypePtr,
                                      bool EnteringContext,
                                      TemplateTy &TemplateResult,
                                      bool &MemberOfUnknownSpecialization,
                                      bool Disambiguation) {
                                      bool &MemberOfUnknownSpecialization) {
  assert(getLangOpts().CPlusPlus && "No template names in C!");

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

  if (AssumedTemplate != AssumedTemplateKind::None) {
@@ -372,8 +371,7 @@ bool Sema::LookupTemplateName(LookupResult &Found,
                              bool EnteringContext,
                              bool &MemberOfUnknownSpecialization,
                              SourceLocation TemplateKWLoc,
                              AssumedTemplateKind *ATK,
                              bool Disambiguation) {
                              AssumedTemplateKind *ATK) {
  if (ATK)
    *ATK = AssumedTemplateKind::None;

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

  if (Found.empty() && !IsDependent && !Disambiguation) {
    // If we did not find any names, and this is not a disambiguation, attempt
    // to correct any typos.
  if (Found.empty() && !IsDependent) {
    // If we did not find any names, attempt to correct any typos.
    DeclarationName Name = Found.getLookupName();
    Found.clear();
    // Simple filter callback that, for keywords, only accepts the C++ *_cast
+0 −1
Original line number Diff line number Diff line
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s

class X {};

Loading