|
9 | 9 | //===----------------------------------------------------------------------===//
|
10 | 10 |
|
11 | 11 | #include "TreeTransform.h"
|
| 12 | +#include "clang/AST/ASTConcept.h" |
12 | 13 | #include "clang/AST/ASTConsumer.h"
|
13 | 14 | #include "clang/AST/ASTContext.h"
|
14 | 15 | #include "clang/AST/Decl.h"
|
@@ -1181,10 +1182,9 @@ static ExprResult formImmediatelyDeclaredConstraint(
|
1181 | 1182 | if (auto *CD = dyn_cast<ConceptDecl>(NamedConcept)) {
|
1182 | 1183 | ImmediatelyDeclaredConstraint = S.CheckConceptTemplateId(
|
1183 | 1184 | SS, /*TemplateKWLoc=*/SourceLocation(), NameInfo,
|
1184 |
| - /*FoundDecl=*/FoundDecl ? FoundDecl : NamedConcept, NamedConcept, |
1185 |
| - &ConstraintArgs, |
1186 |
| - /*DoCheckConstraintSatisfaction=*/ |
1187 |
| - !S.inParameterMappingSubstitution()); |
| 1185 | + /*FoundDecl=*/FoundDecl ? FoundDecl : CD, CD, &ConstraintArgs, |
| 1186 | + /*DoCheckConstraintSatisfaction=*/ |
| 1187 | + !S.inParameterMappingSubstitution()); |
1188 | 1188 | }
|
1189 | 1189 | // We have a template template parameter
|
1190 | 1190 | else {
|
@@ -4802,7 +4802,7 @@ void Sema::diagnoseMissingTemplateArguments(const CXXScopeSpec &SS,
|
4802 | 4802 | ExprResult Sema::CheckConceptTemplateId(
|
4803 | 4803 | const CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
|
4804 | 4804 | const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl,
|
4805 |
| - ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs, |
| 4805 | + TemplateDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs, |
4806 | 4806 | bool DoCheckConstraintSatisfaction) {
|
4807 | 4807 | assert(NamedConcept && "A concept template id without a template?");
|
4808 | 4808 |
|
@@ -4842,18 +4842,19 @@ ExprResult Sema::CheckConceptTemplateId(
|
4842 | 4842 | ASTTemplateArgumentListInfo::Create(Context, *TemplateArgs));
|
4843 | 4843 |
|
4844 | 4844 | bool Error = false;
|
4845 |
| - if (!AreArgsDependent && DoCheckConstraintSatisfaction) { |
| 4845 | + if (const auto *Concept = dyn_cast<ConceptDecl>(NamedConcept); |
| 4846 | + Concept && Concept->getConstraintExpr() && !AreArgsDependent && |
| 4847 | + DoCheckConstraintSatisfaction) { |
4846 | 4848 |
|
4847 |
| - LocalInstantiationScope Scope(*this); |
| 4849 | + LocalInstantiationScope Scope(*this); |
4848 | 4850 |
|
4849 |
| - EnterExpressionEvaluationContext EECtx{ |
4850 |
| - *this, ExpressionEvaluationContext::Unevaluated, CSD}; |
| 4851 | + EnterExpressionEvaluationContext EECtx{ |
| 4852 | + *this, ExpressionEvaluationContext::Unevaluated, CSD}; |
4851 | 4853 |
|
4852 | 4854 | Error = CheckConstraintSatisfaction(
|
4853 |
| - NamedConcept, AssociatedConstraint(NamedConcept->getConstraintExpr()), |
4854 |
| - MLTAL, |
4855 |
| - SourceRange(SS.isSet() ? SS.getBeginLoc() : ConceptNameInfo.getLoc(), |
4856 |
| - TemplateArgs->getRAngleLoc()), |
| 4855 | + NamedConcept, AssociatedConstraint(Concept->getConstraintExpr()), MLTAL, |
| 4856 | + SourceRange(SS.isSet() ? SS.getBeginLoc() : ConceptNameInfo.getLoc(), |
| 4857 | + TemplateArgs->getRAngleLoc()), |
4857 | 4858 | Satisfaction, CL);
|
4858 | 4859 | Satisfaction.ContainsErrors = Error;
|
4859 | 4860 | }
|
|
0 commit comments