diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp index e5b1833a02f2a..ec8b00a9eb7d1 100644 --- a/clang/lib/AST/DeclTemplate.cpp +++ b/clang/lib/AST/DeclTemplate.cpp @@ -74,7 +74,8 @@ TemplateParameterList::TemplateParameterList(const ASTContext& C, ->containsUnexpandedParameterPack()) ContainsUnexpandedParameterPack = true; } - HasConstrainedParameters = TTP->hasTypeConstraint(); + if (TTP->hasTypeConstraint()) + HasConstrainedParameters = true; } else { llvm_unreachable("unexpcted template parameter type"); } diff --git a/clang/test/SemaTemplate/concepts.cpp b/clang/test/SemaTemplate/concepts.cpp index 60c8bc59d33ce..c297a75dd82e6 100644 --- a/clang/test/SemaTemplate/concepts.cpp +++ b/clang/test/SemaTemplate/concepts.cpp @@ -154,3 +154,18 @@ namespace NoConstantFolding { template concept C = &n + 3 - 3 == &n; // expected-error {{non-constant expression}} expected-note {{cannot refer to element 3 of non-array object}} static_assert(C); // expected-note {{while checking}} } + +namespace PR50337 { + template concept foo = true; + template concept foo2 = foo && true; + void f(foo auto, auto); + void f(foo2 auto, auto); + void g() { f(1, 2); } +} + +namespace PR50561 { + template concept C = false; + template void f(T, U); + template void f(T, U) = delete; + void g() { f(0, 0); } +}