Commit ea79b3bc authored by Tom Weaver's avatar Tom Weaver
Browse files

Revert "[Sema] `setInvalidDecl` for error deduction declaration"

parent f2a6a970
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -392,8 +392,6 @@ Bug Fixes in This Version
- Fix crash when attempting to perform parenthesized initialization of an
  aggregate with a base class with only non-public constructors.
  (`#62296 <https://github.com/llvm/llvm-project/issues/62296>`_)
- Fix crash when handling initialization candidates for invalid deduction guide.
  (`#62408 <https://github.com/llvm/llvm-project/issues/62408>`_)
- Fix crash when redefining a variable with an invalid type again with an
  invalid type. (`#62447 <https://github.com/llvm/llvm-project/issues/62447>`_)
- Fix a stack overflow issue when evaluating ``consteval`` default arguments.
+1 −1
Original line number Diff line number Diff line
@@ -7790,7 +7790,7 @@ public:
  void CheckConversionDeclarator(Declarator &D, QualType &R,
                                 StorageClass& SC);
  Decl *ActOnConversionDeclarator(CXXConversionDecl *Conversion);
  bool CheckDeductionGuideDeclarator(Declarator &D, QualType &R,
  void CheckDeductionGuideDeclarator(Declarator &D, QualType &R,
                                     StorageClass &SC);
  void CheckDeductionGuideTemplate(FunctionTemplateDecl *TD);
+2 −2
Original line number Diff line number Diff line
@@ -9199,8 +9199,8 @@ static FunctionDecl *CreateNewFunctionDecl(Sema &SemaRef, Declarator &D,
      SemaRef.Diag(TrailingRequiresClause->getBeginLoc(),
                   diag::err_trailing_requires_clause_on_deduction_guide)
          << TrailingRequiresClause->getSourceRange();
    if (SemaRef.CheckDeductionGuideDeclarator(D, R, SC))
      return nullptr;
    SemaRef.CheckDeductionGuideDeclarator(D, R, SC);
    return CXXDeductionGuideDecl::Create(SemaRef.Context, DC, D.getBeginLoc(),
                                         ExplicitSpecifier, NameInfo, R, TInfo,
                                         D.getEndLoc());
+10 −9
Original line number Diff line number Diff line
@@ -11087,8 +11087,8 @@ struct BadSpecifierDiagnoser {
/// Check the validity of a declarator that we parsed for a deduction-guide.
/// These aren't actually declarators in the grammar, so we need to check that
/// the user didn't specify any pieces that are not part of the deduction-guide
/// grammar. Return true on invalid deduction-guide.
bool Sema::CheckDeductionGuideDeclarator(Declarator &D, QualType &R,
/// grammar.
void Sema::CheckDeductionGuideDeclarator(Declarator &D, QualType &R,
                                         StorageClass &SC) {
  TemplateName GuidedTemplate = D.getName().TemplateName.get().get();
  TemplateDecl *GuidedTemplateDecl = GuidedTemplate.getAsTemplateDecl();
@@ -11138,7 +11138,7 @@ bool Sema::CheckDeductionGuideDeclarator(Declarator &D, QualType &R,
  }
  if (D.isInvalidType())
    return true;
    return;
  // Check the declarator is simple enough.
  bool FoundFunction = false;
@@ -11151,9 +11151,11 @@ bool Sema::CheckDeductionGuideDeclarator(Declarator &D, QualType &R,
          << D.getSourceRange();
      break;
    }
    if (!Chunk.Fun.hasTrailingReturnType())
      return Diag(D.getName().getBeginLoc(),
    if (!Chunk.Fun.hasTrailingReturnType()) {
      Diag(D.getName().getBeginLoc(),
           diag::err_deduction_guide_no_trailing_return_type);
      break;
    }
    // Check that the return type is written as a specialization of
    // the template specified as the deduction-guide's name.
@@ -11188,12 +11190,13 @@ bool Sema::CheckDeductionGuideDeclarator(Declarator &D, QualType &R,
      MightInstantiateToSpecialization = true;
    }
    if (!AcceptableReturnType)
      return Diag(TSI->getTypeLoc().getBeginLoc(),
    if (!AcceptableReturnType) {
      Diag(TSI->getTypeLoc().getBeginLoc(),
           diag::err_deduction_guide_bad_trailing_return_type)
          << GuidedTemplate << TSI->getType()
          << MightInstantiateToSpecialization
          << TSI->getTypeLoc().getSourceRange();
    }
    // Keep going to check that we don't have any inner declarator pieces (we
    // could still have a function returning a pointer to a function).
@@ -11201,9 +11204,7 @@ bool Sema::CheckDeductionGuideDeclarator(Declarator &D, QualType &R,
  }
  if (D.isFunctionDefinition())
    // we can still create a valid deduction guide here.
    Diag(D.getIdentifierLoc(), diag::err_deduction_guide_defines_function);
  return false;
}
//===----------------------------------------------------------------------===//
+3 −3
Original line number Diff line number Diff line
@@ -173,10 +173,10 @@ template <class a, class e>
concept g = f<a, e>::h;
template <class a, class e>
concept i = g<e, a>;
template <typename> class j {
template <typename> class j { // expected-note {{candidate template ignored}}
  template <typename k>
  requires requires { requires i<j, k>; }
  j();
  j(); // expected-note {{candidate template ignored}}
};
template <> j(); // expected-error {{deduction guide declaration without trailing return type}}
template <> j(); // expected-error {{deduction guide declaration without trailing return type}} // expected-error {{no function template}}
}
Loading