// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 -DSTD1 %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 -DSTD2 %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 -DSTD3 %s namespace std { #ifdef STD1 template struct is_trivially_relocatable { static constexpr bool value = __builtin_is_cpp_trivially_relocatable(T); }; template constexpr bool is_trivially_relocatable_v = __builtin_is_cpp_trivially_relocatable(T); template struct is_trivially_copyable { static constexpr bool value = __is_trivially_copyable(T); }; template constexpr bool is_trivially_copyable_v = __is_trivially_copyable(T); template struct is_assignable { static constexpr bool value = __is_assignable(T, U); }; template constexpr bool is_assignable_v = __is_assignable(T, U); template struct is_empty { static constexpr bool value = __is_empty(T); }; template constexpr bool is_empty_v = __is_empty(T); template struct is_standard_layout { static constexpr bool value = __is_standard_layout(T); }; template constexpr bool is_standard_layout_v = __is_standard_layout(T); template struct is_constructible { static constexpr bool value = __is_constructible(Args...); }; template constexpr bool is_constructible_v = __is_constructible(Args...); template struct is_aggregate { static constexpr bool value = __is_aggregate(T); }; template constexpr bool is_aggregate_v = __is_aggregate(T); template struct is_final { static constexpr bool value = __is_final(T); }; template constexpr bool is_final_v = __is_final(T); template struct is_abstract { static constexpr bool value = __is_abstract(T); }; template constexpr bool is_abstract_v = __is_abstract(T); #endif #ifdef STD2 template struct __details_is_trivially_relocatable { static constexpr bool value = __builtin_is_cpp_trivially_relocatable(T); }; template using is_trivially_relocatable = __details_is_trivially_relocatable; template constexpr bool is_trivially_relocatable_v = __builtin_is_cpp_trivially_relocatable(T); template struct __details_is_trivially_copyable { static constexpr bool value = __is_trivially_copyable(T); }; template using is_trivially_copyable = __details_is_trivially_copyable; template constexpr bool is_trivially_copyable_v = __is_trivially_copyable(T); template struct __details_is_assignable { static constexpr bool value = __is_assignable(T, U); }; template using is_assignable = __details_is_assignable; template constexpr bool is_assignable_v = __is_assignable(T, U); template struct __details_is_empty { static constexpr bool value = __is_empty(T); }; template using is_empty = __details_is_empty; template constexpr bool is_empty_v = __is_empty(T); template struct __details_is_standard_layout { static constexpr bool value = __is_standard_layout(T); }; template using is_standard_layout = __details_is_standard_layout; template constexpr bool is_standard_layout_v = __is_standard_layout(T); template struct __details_is_constructible{ static constexpr bool value = __is_constructible(Args...); }; template using is_constructible = __details_is_constructible; template constexpr bool is_constructible_v = __is_constructible(Args...); template struct __details_is_aggregate { static constexpr bool value = __is_aggregate(T); }; template using is_aggregate = __details_is_aggregate; template constexpr bool is_aggregate_v = __is_aggregate(T); template struct __details_is_final { static constexpr bool value = __is_final(T); }; template using is_final = __details_is_final; template constexpr bool is_final_v = __is_final(T); template struct __details_is_abstract { static constexpr bool value = __is_abstract(T); }; template using is_abstract = __details_is_abstract; template constexpr bool is_abstract_v = __is_abstract(T); #endif #ifdef STD3 template< class T, T v > struct integral_constant { static constexpr T value = v; }; template< bool B > using bool_constant = integral_constant; template struct __details_is_trivially_relocatable : bool_constant<__builtin_is_cpp_trivially_relocatable(T)> {}; template using is_trivially_relocatable = __details_is_trivially_relocatable; template constexpr bool is_trivially_relocatable_v = is_trivially_relocatable::value; template struct __details_is_trivially_copyable : bool_constant<__is_trivially_copyable(T)> {}; template using is_trivially_copyable = __details_is_trivially_copyable; template constexpr bool is_trivially_copyable_v = is_trivially_copyable::value; template struct __details_is_assignable : bool_constant<__is_assignable(T, U)> {}; template using is_assignable = __details_is_assignable; template constexpr bool is_assignable_v = is_assignable::value; template struct __details_is_empty : bool_constant<__is_empty(T)> {}; template using is_empty = __details_is_empty; template constexpr bool is_empty_v = is_empty::value; template struct __details_is_standard_layout : bool_constant<__is_standard_layout(T)> {}; template using is_standard_layout = __details_is_standard_layout; template constexpr bool is_standard_layout_v = is_standard_layout::value; template struct __details_is_constructible : bool_constant<__is_constructible(Args...)> {}; template using is_constructible = __details_is_constructible; template constexpr bool is_constructible_v = is_constructible::value; template struct __details_is_aggregate : bool_constant<__is_aggregate(T)> {}; template using is_aggregate = __details_is_aggregate; template constexpr bool is_aggregate_v = is_aggregate::value; template struct __details_is_final : bool_constant<__is_final(T)> {}; template using is_final = __details_is_final; template constexpr bool is_final_v = is_final::value; template struct __details_is_abstract : bool_constant<__is_abstract(T)> {}; template using is_abstract = __details_is_abstract; template constexpr bool is_abstract_v = is_abstract::value; #endif } static_assert(std::is_trivially_relocatable::value); static_assert(std::is_trivially_relocatable::value); // expected-error-re@-1 {{static assertion failed due to requirement 'std::{{.*}}is_trivially_relocatable::value'}} \ // expected-note@-1 {{'int &' is not trivially relocatable}} \ // expected-note@-1 {{because it is a reference type}} static_assert(std::is_trivially_relocatable_v); // expected-error@-1 {{static assertion failed due to requirement 'std::is_trivially_relocatable_v'}} \ // expected-note@-1 {{'int &' is not trivially relocatable}} \ // expected-note@-1 {{because it is a reference type}} static_assert(std::is_trivially_copyable::value); static_assert(std::is_trivially_copyable::value); // expected-error-re@-1 {{static assertion failed due to requirement 'std::{{.*}}is_trivially_copyable::value'}} \ // expected-note@-1 {{'int &' is not trivially copyable}} \ // expected-note@-1 {{because it is a reference type}} static_assert(std::is_trivially_copyable_v); // expected-error@-1 {{static assertion failed due to requirement 'std::is_trivially_copyable_v'}} \ // expected-note@-1 {{'int &' is not trivially copyable}} \ // expected-note@-1 {{because it is a reference type}} // Direct tests static_assert(std::is_standard_layout::value); static_assert(std::is_standard_layout_v); static_assert(std::is_standard_layout::value); // expected-error-re@-1 {{static assertion failed due to requirement 'std::{{.*}}is_standard_layout::value'}} \ // expected-note@-1 {{'int &' is not standard-layout}} \ // expected-note@-1 {{because it is a reference type}} static_assert(std::is_standard_layout_v); // expected-error@-1 {{static assertion failed due to requirement 'std::is_standard_layout_v'}} \ // expected-note@-1 {{'int &' is not standard-layout}} \ // expected-note@-1 {{because it is a reference type}} static_assert(!std::is_empty::value); static_assert(std::is_empty::value); // expected-error-re@-1 {{static assertion failed due to requirement 'std::{{.*}}is_empty::value'}} \ // expected-note@-1 {{'int &' is not empty}} \ // expected-note@-1 {{because it is a reference type}} static_assert(std::is_empty_v); // expected-error@-1 {{static assertion failed due to requirement 'std::is_empty_v'}} \ // expected-note@-1 {{'int &' is not empty}} \ // expected-note@-1 {{because it is a reference type}} static_assert(std::is_assignable::value); static_assert(std::is_assignable::value); // expected-error-re@-1 {{static assertion failed due to requirement 'std::{{.*}}is_assignable::value'}} \ // expected-error@-1 {{assigning to 'int' from incompatible type 'void'}} static_assert(std::is_assignable_v); // expected-error@-1 {{static assertion failed due to requirement 'std::is_assignable_v'}} \ // expected-error@-1 {{assigning to 'int' from incompatible type 'void'}} static_assert(std::is_constructible::value); static_assert(std::is_constructible::value); // expected-error-re@-1 {{static assertion failed due to requirement 'std::{{.*}}is_constructible::value'}} \ // expected-note@-1 {{because it is a cv void type}} static_assert(std::is_constructible_v); // expected-error@-1 {{static assertion failed due to requirement 'std::is_constructible_v'}} \ // expected-note@-1 {{because it is a cv void type}} static_assert(!std::is_final::value); static_assert(std::is_final::value); // expected-error-re@-1 {{static assertion failed due to requirement 'std::{{.*}}is_final::value'}} \ // expected-note@-1 {{'int &' is not final}} \ // expected-note@-1 {{because it is a reference type}} \ // expected-note@-1 {{because it is not a class or union type}} static_assert(std::is_final_v); // expected-error@-1 {{static assertion failed due to requirement 'std::is_final_v'}} \ // expected-note@-1 {{'int &' is not final}} \ // expected-note@-1 {{because it is a reference type}} \ // expected-note@-1 {{because it is not a class or union type}} using Arr = int[3]; static_assert(std::is_final::value); // expected-error-re@-1 {{static assertion failed due to requirement 'std::{{.*}}is_final::value'}} \ // expected-note@-1 {{'Arr' (aka 'int[3]') is not final}} \ // expected-note@-1 {{because it is not a class or union type}} static_assert(std::is_final_v); // expected-error@-1 {{static assertion failed due to requirement 'std::is_final_v'}} \ // expected-note@-1 {{'int[3]' is not final}} \ // expected-note@-1 {{because it is not a class or union type}} static_assert(!std::is_aggregate::value); static_assert(std::is_aggregate::value); // expected-error-re@-1 {{static assertion failed due to requirement 'std::{{.*}}is_aggregate::value'}} \ // expected-note@-1 {{'void' is not aggregate}} \ // expected-note@-1 {{because it is a cv void type}} static_assert(std::is_aggregate_v); // expected-error@-1 {{static assertion failed due to requirement 'std::is_aggregate_v'}} \ // expected-note@-1 {{'void' is not aggregate}} \ // expected-note@-1 {{because it is a cv void type}} static_assert(!std::is_abstract::value); static_assert(std::is_abstract::value); // expected-error-re@-1 {{static assertion failed due to requirement 'std::{{.*}}is_abstract::value'}} \ // expected-note@-1 {{'int &' is not abstract}} \ // expected-note@-1 {{because it is a reference type}} \ // expected-note@-1 {{because it is not a struct or class type}} static_assert(std::is_abstract_v); // expected-error@-1 {{static assertion failed due to requirement 'std::is_abstract_v'}} \ // expected-note@-1 {{'int &' is not abstract}} \ // expected-note@-1 {{because it is a reference type}} \ // expected-note@-1 {{because it is not a struct or class type}} namespace test_namespace { using namespace std; static_assert(is_trivially_relocatable::value); // expected-error-re@-1 {{static assertion failed due to requirement '{{.*}}is_trivially_relocatable::value'}} \ // expected-note@-1 {{'int &' is not trivially relocatable}} \ // expected-note@-1 {{because it is a reference type}} static_assert(is_trivially_relocatable_v); // expected-error@-1 {{static assertion failed due to requirement 'is_trivially_relocatable_v'}} \ // expected-note@-1 {{'int &' is not trivially relocatable}} \ // expected-note@-1 {{because it is a reference type}} static_assert(is_trivially_copyable::value); // expected-error-re@-1 {{static assertion failed due to requirement '{{.*}}is_trivially_copyable::value'}} \ // expected-note@-1 {{'int &' is not trivially copyable}} \ // expected-note@-1 {{because it is a reference type}} static_assert(is_trivially_copyable_v); // expected-error@-1 {{static assertion failed due to requirement 'is_trivially_copyable_v'}} \ // expected-note@-1 {{'int &' is not trivially copyable}} \ // expected-note@-1 {{because it is a reference type}} static_assert(is_standard_layout::value); // expected-error-re@-1 {{static assertion failed due to requirement '{{.*}}is_standard_layout::value'}} \ // expected-note@-1 {{'int &' is not standard-layout}} \ // expected-note@-1 {{because it is a reference type}} static_assert(is_standard_layout_v); // expected-error@-1 {{static assertion failed due to requirement 'is_standard_layout_v'}} \ // expected-note@-1 {{'int &' is not standard-layout}} \ // expected-note@-1 {{because it is a reference type}} static_assert(is_assignable::value); // expected-error-re@-1 {{static assertion failed due to requirement '{{.*}}is_assignable::value'}} \ // expected-error@-1 {{assigning to 'int' from incompatible type 'void'}} static_assert(is_assignable_v); // expected-error@-1 {{static assertion failed due to requirement 'is_assignable_v'}} \ // expected-error@-1 {{assigning to 'int' from incompatible type 'void'}} static_assert(is_empty::value); // expected-error-re@-1 {{static assertion failed due to requirement '{{.*}}is_empty::value'}} \ // expected-note@-1 {{'int &' is not empty}} \ // expected-note@-1 {{because it is a reference type}} static_assert(is_empty_v); // expected-error@-1 {{static assertion failed due to requirement 'is_empty_v'}} \ // expected-note@-1 {{'int &' is not empty}} \ // expected-note@-1 {{because it is a reference type}} static_assert(is_constructible::value); // expected-error-re@-1 {{static assertion failed due to requirement '{{.*}}is_constructible::value'}} \ // expected-note@-1 {{because it is a cv void type}} static_assert(is_constructible_v); // expected-error@-1 {{static assertion failed due to requirement 'is_constructible_v'}} \ // expected-note@-1 {{because it is a cv void type}} static_assert(std::is_aggregate::value); // expected-error-re@-1 {{static assertion failed due to requirement 'std::{{.*}}is_aggregate::value'}} \ // expected-note@-1 {{'void' is not aggregate}} \ // expected-note@-1 {{because it is a cv void type}} static_assert(std::is_aggregate_v); // expected-error@-1 {{static assertion failed due to requirement 'std::is_aggregate_v'}} \ // expected-note@-1 {{'void' is not aggregate}} \ // expected-note@-1 {{because it is a cv void type}} static_assert(is_final::value); // expected-error-re@-1 {{static assertion failed due to requirement '{{.*}}is_final::value'}} \ // expected-note@-1 {{'int &' is not final}} \ // expected-note@-1 {{because it is a reference type}} \ // expected-note@-1 {{because it is not a class or union type}} static_assert(is_final_v); // expected-error@-1 {{static assertion failed due to requirement 'is_final_v'}} \ // expected-note@-1 {{'int &' is not final}} \ // expected-note@-1 {{because it is a reference type}} \ // expected-note@-1 {{because it is not a class or union type}} using A = int[2]; static_assert(is_final::value); // expected-error-re@-1 {{static assertion failed due to requirement '{{.*}}is_final::value'}} \ // expected-note@-1 {{'A' (aka 'int[2]') is not final}} \ // expected-note@-1 {{because it is not a class or union type}} using Fn = void(); static_assert(is_final::value); // expected-error-re@-1 {{static assertion failed due to requirement '{{.*}}is_final::value'}} \ // expected-note@-1 {{'Fn' (aka 'void ()') is not final}} \ // expected-note@-1 {{because it is a function type}} \ // expected-note@-1 {{because it is not a class or union type}} static_assert(is_abstract::value); // expected-error-re@-1 {{static assertion failed due to requirement '{{.*}}is_abstract::value'}} \ // expected-note@-1 {{'int &' is not abstract}} \ // expected-note@-1 {{because it is a reference type}} \ // expected-note@-1 {{because it is not a struct or class type}} static_assert(is_abstract_v); // expected-error@-1 {{static assertion failed due to requirement 'is_abstract_v'}} \ // expected-note@-1 {{'int &' is not abstract}} \ // expected-note@-1 {{because it is a reference type}} \ // expected-note@-1 {{because it is not a struct or class type}} } namespace concepts { template requires std::is_trivially_relocatable::value void f(); // #cand1 template concept C = std::is_trivially_relocatable_v; // #concept2 template void g(); // #cand2 template requires std::is_trivially_copyable::value void f2(); // #cand3 template concept C2 = std::is_trivially_copyable_v; // #concept4 template void g2(); // #cand4 template requires std::is_assignable::value void f4(); // #cand7 template concept C4 = std::is_assignable_v; // #concept8 template T> void g4(); // #cand8 template requires std::is_constructible::value void f3(); // #cand5 template concept C3 = std::is_constructible_v; // #concept6 template void g3(); // #cand6 template requires std::is_aggregate::value void f5(); // #cand9 template concept C5 = std::is_aggregate_v; // #concept10 template void g5(); // #cand10 void test() { f(); // expected-error@-1 {{no matching function for call to 'f'}} \ // expected-note@#cand1 {{candidate template ignored: constraints not satisfied [with T = int &]}} \ // expected-note-re@#cand1 {{because '{{.*}}is_trivially_relocatable::value' evaluated to false}} \ // expected-note@#cand1 {{'int &' is not trivially relocatable}} \ // expected-note@#cand1 {{because it is a reference type}} g(); // expected-error@-1 {{no matching function for call to 'g'}} \ // expected-note@#cand2 {{candidate template ignored: constraints not satisfied [with T = int &]}} \ // expected-note@#cand2 {{because 'int &' does not satisfy 'C'}} \ // expected-note@#concept2 {{because 'std::is_trivially_relocatable_v' evaluated to false}} \ // expected-note@#concept2 {{'int &' is not trivially relocatable}} \ // expected-note@#concept2 {{because it is a reference type}} f2(); // expected-error@-1 {{no matching function for call to 'f2'}} \ // expected-note@#cand3 {{candidate template ignored: constraints not satisfied [with T = int &]}} \ // expected-note-re@#cand3 {{because '{{.*}}is_trivially_copyable::value' evaluated to false}} \ // expected-note@#cand3 {{'int &' is not trivially copyable}} \ // expected-note@#cand3 {{because it is a reference type}} g2(); // expected-error@-1 {{no matching function for call to 'g2'}} \ // expected-note@#cand4 {{candidate template ignored: constraints not satisfied [with T = int &]}} \ // expected-note@#cand4 {{because 'int &' does not satisfy 'C2'}} \ // expected-note@#concept4 {{because 'std::is_trivially_copyable_v' evaluated to false}} \ // expected-note@#concept4 {{'int &' is not trivially copyable}} \ // expected-note@#concept4 {{because it is a reference type}} f4(); // expected-error@-1 {{no matching function for call to 'f4'}} \ // expected-note@#cand7 {{candidate template ignored: constraints not satisfied [with T = int &, U = void]}} \ // expected-note-re@#cand7 {{because '{{.*}}is_assignable::value' evaluated to false}} \ // expected-error@#cand7 {{assigning to 'int' from incompatible type 'void'}} g4(); // expected-error@-1 {{no matching function for call to 'g4'}} \ // expected-note@#cand8 {{candidate template ignored: constraints not satisfied [with T = int &]}} \ // expected-note@#cand8 {{because 'C4' evaluated to false}} \ // expected-note@#concept8 {{because 'std::is_assignable_v' evaluated to false}} \ // expected-error@#concept8 {{assigning to 'int' from incompatible type 'void'}} f3(); // expected-error@-1 {{no matching function for call to 'f3'}} \ // expected-note@#cand5 {{candidate template ignored: constraints not satisfied [with Args = ]}} \ // expected-note-re@#cand5 {{because '{{.*}}is_constructible::value' evaluated to false}} \ // expected-note@#cand5 {{because it is a cv void type}} g3(); // expected-error@-1 {{no matching function for call to 'g3'}} \ // expected-note@#cand6 {{candidate template ignored: constraints not satisfied [with T = void]}} \ // expected-note@#cand6 {{because 'void' does not satisfy 'C3'}} \ // expected-note@#concept6 {{because 'std::is_constructible_v' evaluated to false}} \ // expected-note@#concept6 {{because it is a cv void type}} f5(); // expected-error@-1 {{no matching function for call to 'f5'}} \ // expected-note@#cand9 {{candidate template ignored: constraints not satisfied [with T = void]}} \ // expected-note-re@#cand9 {{because '{{.*}}is_aggregate::value' evaluated to false}} \ // expected-note@#cand9 {{'void' is not aggregate}} \ // expected-note@#cand9 {{because it is a cv void type}} g5(); // expected-error@-1 {{no matching function for call to 'g5'}} \ // expected-note@#cand10 {{candidate template ignored: constraints not satisfied [with T = void]}} \ // expected-note@#cand10 {{because 'void' does not satisfy 'C5'}} \ // expected-note@#concept10 {{because 'std::is_aggregate_v' evaluated to false}} \ // expected-note@#concept10 {{'void' is not aggregate}} \ // expected-note@#concept10 {{because it is a cv void type}} } } namespace std { template struct is_replaceable { static constexpr bool value = __builtin_is_replaceable(T); }; template constexpr bool is_replaceable_v = __builtin_is_replaceable(T); } static_assert(std::is_replaceable::value); // expected-error@-1 {{static assertion failed due to requirement 'std::is_replaceable::value'}} \ // expected-note@-1 {{'int &' is not replaceable}} \ // expected-note@-1 {{because it is a reference type}} static_assert(std::is_replaceable_v); // expected-error@-1 {{static assertion failed due to requirement 'std::is_replaceable_v'}} \ // expected-note@-1 {{'int &' is not replaceable}} \ // expected-note@-1 {{because it is a reference type}}