// RUN: %clang_cc1 -std=c++20 -verify %s // RUN: %clang_cc1 -std=c++20 -verify %s -DDEPENDENT_OR #ifdef DEPENDENT_OR // This causes the || below to be a CXXOperatorCallExpr not a BinaryOperator. struct A {}; bool operator||(A, A); #endif namespace PR45589 { template struct X { static constexpr bool value = T::value; }; // expected-error {{cannot be used prior to '::'}} struct False { static constexpr bool value = false; }; struct True { static constexpr bool value = true; }; template concept C = true; template constexpr int test = 0; template requires C constexpr int test = 1; template requires (B && C) || (X::value && C) constexpr int test = 2; // expected-error {{non-constant expression}} expected-note {{subexpression}} expected-note {{instantiation of}} expected-note {{while substituting}} static_assert(test == 2); static_assert(test == 2); static_assert(test == 2); // satisfaction of second term of || not considered static_assert(test == 1); static_assert(test == 2); // constraints are partially ordered // FIXME: These diagnostics are excessive. static_assert(test == 1); // expected-note 2{{while}} expected-note 2{{during}} } namespace PR52905 { // A mock for std::convertible_to. Not complete support. template concept convertible_to = __is_convertible_to(_From, _To); // expected-note {{evaluated to false}} template class A { public: using iterator = void **; iterator begin(); const iterator begin() const; }; template concept Beginable1 = requires(T t) { { t.begin } ->convertible_to; // expected-note {{not satisfied}} }; static_assert(Beginable1>); // expected-error {{static_assert failed}} // expected-note@-1 {{does not satisfy 'Beginable1'}} template concept Beginable2 = requires(T t) { { t.begin() } ->convertible_to; }; static_assert(Beginable2>); } // namespace PR52905