1 // RUN: %clang_cc1 -std=c++2a -x c++ -verify %s
3 template<typename T
> requires (sizeof(T
) >= 4)
4 // expected-note@-1{{similar constraint expressions not considered equivalent}}
5 bool a
= false; // expected-note{{template is declared here}}
7 template<typename T
> requires (sizeof(T
) >= 4 && sizeof(T
) <= 10)
8 // expected-note@-1{{similar constraint expression here}}
9 bool a
<T
> = true; // expected-error{{variable template partial specialization is not more specialized than the primary template}}
12 concept C1
= sizeof(T
) >= 4;
14 template<typename T
> requires C1
<T
>
17 template<typename T
> requires (C1
<T
> && sizeof(T
) <= 10)
21 concept C2
= sizeof(T
) > 1 && sizeof(T
) <= 8;
26 template<typename T
> requires C1
<T
>
33 bool d
<T
> = true; // expected-error{{variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list}}
35 template<typename T
> requires C1
<T
>
39 bool e
<T
> = true; // expected-error{{variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list}}
44 template<typename T
> requires C1
<T
> && C2
<T
>
45 constexpr int f
<T
> = 2;
47 template<typename T
> requires C1
<T
> || C2
<T
>
48 constexpr int f
<T
> = 3;
50 static_assert(f
<unsigned> == 2);
51 static_assert(f
<char[10]> == 3);
52 static_assert(f
<char> == 1);
57 static constexpr int f
= 1;
60 requires C1
<T
> && C2
<T
>
61 static constexpr int f
<T
> = 2;
64 requires C1
<T
> || C2
<T
>
65 static constexpr int f
<T
> = 3;
68 static_assert(S
<1>::f
<unsigned> == 2);
69 static_assert(S
<1>::f
<char[10]> == 3);
70 static_assert(S
<1>::f
<char> == 1);