// RUN: %clang_cc1 -std=c++2a -x c++ -verify %s template requires (sizeof(T) >= 4) // expected-note@-1{{similar constraint expressions not considered equivalent}} bool a() { return false; } // expected-note {{candidate function [with T = unsigned int]}} template requires (sizeof(T) >= 4 && sizeof(T) <= 10) // expected-note@-1{{similar constraint expression here}} bool a() { return true; } // expected-note {{candidate function [with T = unsigned int]}} bool av = a(); // expected-error {{call to 'a' is ambiguous}} template concept C1 = sizeof(T) >= 4; template requires C1 constexpr bool b() { return false; } template requires (C1 && sizeof(T) <= 10) constexpr bool b() { return true; } static_assert(b()); static_assert(!b()); template concept C2 = sizeof(T) > 1 && sizeof(T) <= 8; template bool c() { return false; } template requires C1 bool c() { return true; } template requires C1 constexpr bool d() { return false; } template constexpr bool d() { return true; } static_assert(!d()); template constexpr int e() { return 1; } template requires C1 && C2 constexpr int e() { return 2; } template requires C1 || C2 constexpr int e() { return 3; } static_assert(e() == 2); static_assert(e() == 3); static_assert(e() == 1); template concept BiggerThan = sizeof(T) > sizeof(U); template concept BiggerThanInt = BiggerThan; template requires BiggerThan void f() { } // expected-note@-1 {{candidate function [with T = long long, U = int]}} template requires BiggerThanInt void f() { } // expected-note@-1 {{candidate function [with T = long long, U = int]}} static_assert(sizeof(f())); // expected-error@-1 {{call to 'f' is ambiguous}} template concept C3 = true; template concept C4 = true && C3; template requires C3 int g() { } template requires C4 int g() { } static_assert(sizeof(g())); // Regression - used template parameter detection when only first out of // multiple parameters are used template struct X {}; template int h(X<0>); template int h(X); static_assert(sizeof(h(X<0>{})));