// RUN: %clang_cc1 -std=c++2a -x c++ -verify %s template concept True = true; template concept Foo = True; template concept Bar = Foo; template requires Bar struct S { }; template requires Bar && true struct S { }; template concept True2 = sizeof(T) >= 0; template concept Foo2 = True2; // expected-error@-1{{'type name' declared as a pointer to a reference of type 'type-parameter-0-0 &'}} template concept Bar2 = Foo2; // expected-note@-1{{while substituting into concept arguments here; substitution failures not allowed in concept arguments}} template requires Bar2 struct S2 { }; // expected-note@-1{{template is declared here}} template requires Bar2 && true struct S2 { }; // expected-error@-1{{class template partial specialization is not more specialized than the primary template}} // expected-note@-2{{while calculating associated constraint of template 'S2' here}} namespace type_pack { template concept C1 = ((sizeof(Args) >= 0) && ...); template concept C2 = C1; template constexpr void foo() requires C2 { } template constexpr void foo() requires C1 && true { } static_assert((foo(), true)); } namespace template_pack { template struct S1 {}; template struct S2 {}; template typename... Args> concept C1 = ((sizeof(Args) >= 0) && ...); template typename A, template typename... B> concept C2 = C1; template typename T> constexpr void foo() requires C2 { } template typename T> constexpr void foo() requires C1 && true { } static_assert((foo(), true)); } namespace non_type_pack { template concept C1 = ((Args >= 0) && ...); template concept C2 = C1; template constexpr void foo() requires C2 { } template constexpr void foo() requires C1 && true { } static_assert((foo<1>(), true)); } namespace PR47174 { // This checks that we don't crash with a failed substitution on the first constrained argument when // performing normalization. template requires true struct S3; // expected-note {{template is declared here}} template requires true struct S3; // expected-error {{class template partial specialization is not more specialized than the primary template}} // Same as above, for the second position (but this was already working). template requires true struct S4; // expected-note {{template is declared here}} template requires true struct S4; // expected-error {{class template partial specialization is not more specialized than the primary template}} struct X { template struct Y { using type = int; }; }; template concept C1 = sizeof(T) != 0; template concept C2 = C1::type>; template requires C1 void t1() {}; // expected-note {{candidate function}} template requires C1 && C2 void t1() = delete; // expected-note {{candidate function}} template void t1(); void t1() { t1(); } // expected-error {{call to deleted function 't1'}} template requires C1 void t2() {}; // expected-note 2 {{candidate function}} template requires C2 void t2() {}; // expected-note 2 {{candidate function}} template void t2(); // expected-error {{partial ordering for explicit instantiation of 't2' is ambiguous}} void t2() { t2(); } // expected-error {{call to 't2' is ambiguous}} } // namespace PR47174