diff options
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r-- | libstdc++-v3/testsuite/24_iterators/indirect_callable/projected-adl.cc | 42 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/std/format/string.cc | 5 |
2 files changed, 47 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/24_iterators/indirect_callable/projected-adl.cc b/libstdc++-v3/testsuite/24_iterators/indirect_callable/projected-adl.cc new file mode 100644 index 0000000..4c2a095 --- /dev/null +++ b/libstdc++-v3/testsuite/24_iterators/indirect_callable/projected-adl.cc @@ -0,0 +1,42 @@ +// { dg-options "-std=gnu++20" } +// { dg-do compile { target c++20 } } + +// P2538R1 ADL-proof std::projected +// https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2538r1.html + +#include <iterator> + +template<typename T> + concept has_diff_type = requires { typename T::difference_type; }; + +static_assert( has_diff_type<std::projected<int*, void(*)(int)>> ); + +struct Indy { + using value_type = int; + int operator*() const { return 0; } +}; +static_assert( ! std::weakly_incrementable<Indy> ); +static_assert( ! has_diff_type<std::projected<Indy, void(*)(int)>> ); + + +// Examples from the paper: + +template<class T> struct Holder { T t; }; +struct Incomplete; + +void test_concepts() +{ + using T = Holder<Incomplete>*; + static_assert(std::equality_comparable<T>); + (void) std::indirectly_comparable<T*, T*, std::equal_to<>>; + (void) std::sortable<T*>; +} + +#include <algorithm> + +void test_count() +{ + Holder<Incomplete>* a = nullptr; + (void) std::count(&a, &a, nullptr); + (void) std::ranges::count(&a, &a, nullptr); // { dg-bogus "." } +} diff --git a/libstdc++-v3/testsuite/std/format/string.cc b/libstdc++-v3/testsuite/std/format/string.cc index e421028..d28135e 100644 --- a/libstdc++-v3/testsuite/std/format/string.cc +++ b/libstdc++-v3/testsuite/std/format/string.cc @@ -121,6 +121,11 @@ test_format_spec() // Invalid presentation types for strings. VERIFY( ! is_format_string_for("{:S}", "str") ); VERIFY( ! is_format_string_for("{:d}", "str") ); + + // Maximum integer value supported for widths and precisions is USHRT_MAX. + VERIFY( is_format_string_for("{:65535}", 1) ); + VERIFY( ! is_format_string_for("{:65536}", 1) ); + VERIFY( ! is_format_string_for("{:9999999}", 1) ); } int main() |