diff --git a/stl/inc/memory b/stl/inc/memory index 3b77c4313b3..69eed6da175 100644 --- a/stl/inc/memory +++ b/stl/inc/memory @@ -142,7 +142,8 @@ namespace ranges { using _Not_quite_object::_Not_quite_object; // clang-format off - template _Se1, _No_throw_forward_iterator _It2, _No_throw_sentinel_for<_It2> _Se2> + template _Se1, _No_throw_forward_iterator _It2, + _No_throw_sentinel_for<_It2> _Se2> requires constructible_from, iter_rvalue_reference_t<_It1>> uninitialized_move_result<_It1, _It2> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2) const { // clang-format on diff --git a/tests/std/tests/Dev11_0437519_container_requirements/test.cpp b/tests/std/tests/Dev11_0437519_container_requirements/test.cpp index 9dc7c995fc2..1ce8819796f 100644 --- a/tests/std/tests/Dev11_0437519_container_requirements/test.cpp +++ b/tests/std/tests/Dev11_0437519_container_requirements/test.cpp @@ -329,42 +329,43 @@ struct emplace_argument { // clang-format off -#define DEFINE_TYPE(name, dtor, default_ctor, copy_ctor, move_ctor, emplace_ctor, copy_assign, move_assign, emplace_assign) \ - class name { \ - public: name(key) { } \ - private: dtor ~name() { } \ - private: default_ctor name() { } \ - private: copy_ctor name(name const&) { } \ - private: move_ctor name(name&&) { } \ - private: emplace_ctor name(emplace_argument&&) { } \ - private: emplace_ctor name(emplace_argument&&, emplace_argument&&) { } \ - private: emplace_ctor name(emplace_argument&&, emplace_argument&&, emplace_argument&&) { } \ - private: copy_assign name& operator=(name const&) { return *this; } \ - private: move_assign name& operator=(name&&) noexcept { return *this; } \ - private: emplace_assign name& operator=(emplace_argument&&) { return *this; } \ +#define DEFINE_TYPE(name, dtor, def_ctor, copy_ctor, move_ctor, emp_ctor, copy_assign, move_assign, emp_assign) \ + class name { \ + public: name(key) { } \ + private: dtor ~name() { } \ + private: def_ctor name() { } \ + private: copy_ctor name(name const&) { } \ + private: move_ctor name(name&&) { } \ + private: emp_ctor name(emplace_argument&&) { } \ + private: emp_ctor name(emplace_argument&&, emplace_argument&&) { } \ + private: emp_ctor name(emplace_argument&&, emplace_argument&&, emplace_argument&&) { } \ + private: copy_assign name& operator=(name const&) { return *this; } \ + private: move_assign name& operator=(name&&) noexcept { return *this; } \ + private: emp_assign name& operator=(emplace_argument&&) { return *this; } \ } #define YES public: -// dtor default ctor copy ctor move ctor emplace ctor copy assign move assign emplace assign -DEFINE_TYPE(erasable , YES , , , , , , , ); -DEFINE_TYPE(default_constructible, YES , YES , , , , , , ); -DEFINE_TYPE(copy_insertable , YES , , YES , YES , , , , ); -DEFINE_TYPE(move_insertable , YES , , , YES , , , , ); -DEFINE_TYPE(emplace_constructible, YES , , , , YES , , , ); -DEFINE_TYPE(copy_assignable , YES , , , , , YES , YES , ); -DEFINE_TYPE(move_assignable , YES , , , , , , YES , ); -DEFINE_TYPE(equality_comparable , YES , , , , , , , ); -DEFINE_TYPE(less_comparable , YES , , , , , , , ); - -DEFINE_TYPE(ca_ci , YES , , YES , YES , , YES , YES , ); -DEFINE_TYPE(ci_ma , YES , , YES , YES , , , YES , ); -DEFINE_TYPE(dc_mi , YES , YES , , YES , , , , ); -DEFINE_TYPE(ec_ma_mi , YES , , , YES , YES , , YES , ); -DEFINE_TYPE(ec_mi , YES , , , YES , YES , , , ); -DEFINE_TYPE(ma_mi , YES , , , YES , , , YES , ); -DEFINE_TYPE(ec_ea , YES , , , , YES , , , YES ); -DEFINE_TYPE(ec_ea_mi , YES , , , YES , YES , , , YES ); +// default copy move emplace copy move emplace +// dtor ctor ctor ctor ctor assign assign assign +DEFINE_TYPE(erasable , YES , , , , , , , ); +DEFINE_TYPE(default_constructible, YES , YES , , , , , , ); +DEFINE_TYPE(copy_insertable , YES , , YES , YES , , , , ); +DEFINE_TYPE(move_insertable , YES , , , YES , , , , ); +DEFINE_TYPE(emplace_constructible, YES , , , , YES , , , ); +DEFINE_TYPE(copy_assignable , YES , , , , , YES , YES , ); +DEFINE_TYPE(move_assignable , YES , , , , , , YES , ); +DEFINE_TYPE(equality_comparable , YES , , , , , , , ); +DEFINE_TYPE(less_comparable , YES , , , , , , , ); + +DEFINE_TYPE(ca_ci , YES , , YES , YES , , YES , YES , ); +DEFINE_TYPE(ci_ma , YES , , YES , YES , , , YES , ); +DEFINE_TYPE(dc_mi , YES , YES , , YES , , , , ); +DEFINE_TYPE(ec_ma_mi , YES , , , YES , YES , , YES , ); +DEFINE_TYPE(ec_mi , YES , , , YES , YES , , , ); +DEFINE_TYPE(ma_mi , YES , , , YES , , , YES , ); +DEFINE_TYPE(ec_ea , YES , , , , YES , , , YES ); +DEFINE_TYPE(ec_ea_mi , YES , , , YES , YES , , , YES ); #undef YES diff --git a/tests/std/tests/P0088R3_variant/test.cpp b/tests/std/tests/P0088R3_variant/test.cpp index 2cf2dd5210d..2857e561b3a 100644 --- a/tests/std/tests/P0088R3_variant/test.cpp +++ b/tests/std/tests/P0088R3_variant/test.cpp @@ -1771,8 +1771,10 @@ int run_test() #if 0 // TRANSITION, P0608 static_assert(std::is_assignable, int>::value == VariantAllowsNarrowingConversions, ""); - static_assert(std::is_assignable, int>::value == VariantAllowsNarrowingConversions, ""); - static_assert(std::is_assignable, int>::value == VariantAllowsNarrowingConversions, ""); + static_assert(std::is_assignable, int>::value + == VariantAllowsNarrowingConversions, ""); + static_assert(std::is_assignable, int>::value + == VariantAllowsNarrowingConversions, ""); static_assert(!std::is_assignable, int>::value, ""); static_assert(!std::is_assignable, decltype("meow")>::value, ""); @@ -3267,8 +3269,10 @@ int run_test() #if 0 // TRANSITION, P0608 static_assert(std::is_constructible, int>::value == VariantAllowsNarrowingConversions, ""); - static_assert(std::is_constructible, int>::value == VariantAllowsNarrowingConversions, ""); - static_assert(std::is_constructible, int>::value == VariantAllowsNarrowingConversions, ""); + static_assert(std::is_constructible, int>::value + == VariantAllowsNarrowingConversions, ""); + static_assert(std::is_constructible, int>::value + == VariantAllowsNarrowingConversions, ""); static_assert(!std::is_constructible, int>::value, ""); static_assert(!std::is_constructible, decltype("meow")>::value, ""); diff --git a/tests/std/tests/VSO_0191296_allocator_construct/test.cpp b/tests/std/tests/VSO_0191296_allocator_construct/test.cpp index 2d368f26821..1d312ad3bb4 100644 --- a/tests/std/tests/VSO_0191296_allocator_construct/test.cpp +++ b/tests/std/tests/VSO_0191296_allocator_construct/test.cpp @@ -217,44 +217,45 @@ struct emplace_argument { // clang-format off -#define DEFINE_TYPE(name, default_ctor, copy_ctor, move_ctor, emplace_ctor, swappable, copy_assign, move_assign, emplace_assign) \ - class name { \ - public: name(key) { } \ - public: ~name() { } \ - private: default_ctor name(alloc_key) { } \ - private: copy_ctor name(alloc_key, name const&) { } \ - private: move_ctor name(alloc_key, name&&) { } \ - private: emplace_ctor name(alloc_key, emplace_argument&&) { } \ - private: emplace_ctor name(alloc_key, emplace_argument&&, emplace_argument&&) { } \ - private: emplace_ctor name(alloc_key, emplace_argument&&, emplace_argument&&, emplace_argument&&) { } \ - private: swappable friend void swap(name&, name&) {} \ - private: copy_assign name& operator=(name const&) { return *this; } \ - private: move_assign name& operator=(name&&) { return *this; } \ - private: emplace_assign name& operator=(emplace_argument&&) { return *this; } \ - private: name() {} \ - private: name(const name&) {} \ +#define DEFINE_TYPE(name, def_ctor, copy_ctor, move_ctor, emp_ctor, swappable, copy_assign, move_assign, emp_assign) \ + class name { \ + public: name(key) { } \ + public: ~name() { } \ + private: def_ctor name(alloc_key) { } \ + private: copy_ctor name(alloc_key, name const&) { } \ + private: move_ctor name(alloc_key, name&&) { } \ + private: emp_ctor name(alloc_key, emplace_argument&&) { } \ + private: emp_ctor name(alloc_key, emplace_argument&&, emplace_argument&&) { } \ + private: emp_ctor name(alloc_key, emplace_argument&&, emplace_argument&&, emplace_argument&&) { } \ + private: swappable friend void swap(name&, name&) {} \ + private: copy_assign name& operator=(name const&) { return *this; } \ + private: move_assign name& operator=(name&&) { return *this; } \ + private: emp_assign name& operator=(emplace_argument&&) { return *this; } \ + private: name() {} \ + private: name(const name&) {} \ } #define YES public: -// default ctor copy ctor move ctor emplace ctor swappable copy assign move assign emplace assign -DEFINE_TYPE(erasable , , , , , , , , ); -DEFINE_TYPE(default_constructible, YES , , , , , , , ); -DEFINE_TYPE(copy_insertable , , YES , YES , , , , , ); -DEFINE_TYPE(move_insertable , , , YES , , , , , ); -DEFINE_TYPE(emplace_constructible, , , , YES , , , , ); -DEFINE_TYPE(copy_assignable , , , , , YES , YES , YES , ); -DEFINE_TYPE(move_assignable , , , , , YES , , YES , ); -DEFINE_TYPE(equality_comparable , , , , , , , , ); -DEFINE_TYPE(less_comparable , , , , , , , , ); -DEFINE_TYPE(ca_ci , , YES , YES , , YES , YES , YES , ); -DEFINE_TYPE(ci_ma , , YES , YES , , YES , , YES , ); -DEFINE_TYPE(dc_mi , YES , , YES , , , , , ); -DEFINE_TYPE(ec_ma_mi , , , YES , YES , YES , , YES , ); -DEFINE_TYPE(ec_mi , , , YES , YES , , , , ); -DEFINE_TYPE(ma_mi , , , YES , , YES , , YES , ); -DEFINE_TYPE(ec_ea , , , , YES , , , , YES ); -DEFINE_TYPE(ec_ea_mi , , , YES , YES , , , , YES ); +// default copy move emplace copy move emplace +// ctor ctor ctor ctor swappable assign assign assign +DEFINE_TYPE(erasable , , , , , , , , ); +DEFINE_TYPE(default_constructible, YES , , , , , , , ); +DEFINE_TYPE(copy_insertable , , YES , YES , , , , , ); +DEFINE_TYPE(move_insertable , , , YES , , , , , ); +DEFINE_TYPE(emplace_constructible, , , , YES , , , , ); +DEFINE_TYPE(copy_assignable , , , , , YES , YES , YES , ); +DEFINE_TYPE(move_assignable , , , , , YES , , YES , ); +DEFINE_TYPE(equality_comparable , , , , , , , , ); +DEFINE_TYPE(less_comparable , , , , , , , , ); +DEFINE_TYPE(ca_ci , , YES , YES , , YES , YES , YES , ); +DEFINE_TYPE(ci_ma , , YES , YES , , YES , , YES , ); +DEFINE_TYPE(dc_mi , YES , , YES , , , , , ); +DEFINE_TYPE(ec_ma_mi , , , YES , YES , YES , , YES , ); +DEFINE_TYPE(ec_mi , , , YES , YES , , , , ); +DEFINE_TYPE(ma_mi , , , YES , , YES , , YES , ); +DEFINE_TYPE(ec_ea , , , , YES , , , , YES ); +DEFINE_TYPE(ec_ea_mi , , , YES , YES , , , , YES ); #undef YES @@ -1429,8 +1430,9 @@ DEFINE_TEST(test_specific_unordered_associative_constructors, copy_constructible_hash const hf((key())); copy_constructible_compare const eq((key())); - (container_type(0, hf, eq, construct_applying_allocator::type>())); - container_type a(0, hf, eq, construct_applying_allocator::type>()); + using T = typename Traits::template bind_value::type; + (container_type(0, hf, eq, construct_applying_allocator())); + container_type a(0, hf, eq, construct_applying_allocator()); } // X(i, j, n, hf, eq, allocator) diff --git a/tools/validate/validate.cpp b/tools/validate/validate.cpp index 02e1e236311..78f8a26b598 100644 --- a/tools/validate/validate.cpp +++ b/tools/validate/validate.cpp @@ -14,6 +14,8 @@ #include using namespace std; +constexpr size_t max_line_length = 120; + class BinaryFile { public: explicit BinaryFile(const filesystem::path& filepath) { @@ -61,6 +63,7 @@ void scan_file(const filesystem::path& filepath, const TabPolicy tab_policy, vec bool has_crlf = false; bool has_utf8_bom = false; + size_t overlength_lines = 0; size_t disallowed_characters = 0; size_t tab_characters = 0; size_t trailing_whitespace_lines = 0; @@ -69,6 +72,8 @@ void scan_file(const filesystem::path& filepath, const TabPolicy tab_policy, vec unsigned char previous2 = '@'; unsigned char previous3 = '@'; + size_t columns = 0; + for (BinaryFile binary_file{filepath}; binary_file.read_next_block(buffer);) { for (const auto& ch : buffer) { if (prev == CR) { @@ -100,10 +105,18 @@ void scan_file(const filesystem::path& filepath, const TabPolicy tab_policy, vec } } - if ((prev == ' ' || prev == '\t') && (ch == CR || ch == LF)) { - ++trailing_whitespace_lines; - } + if (ch == CR || ch == LF) { + if (prev == ' ' || prev == '\t') { + ++trailing_whitespace_lines; + } + if (columns > max_line_length) { + ++overlength_lines; + } + columns = 0; + } else { + ++columns; + } previous3 = exchange(previous2, exchange(prev, ch)); } } @@ -149,6 +162,23 @@ void scan_file(const filesystem::path& filepath, const TabPolicy tab_policy, vec fwprintf(stderr, L"Validation failed: %ls contains %zu lines with trailing whitespace.\n", filepath.c_str(), trailing_whitespace_lines); } + + if (overlength_lines != 0) { + static constexpr array checked_extensions{ + // line length should be capped in files with these extensions: + L""sv, + L".cpp"sv, + L".h"sv, + L".hpp"sv, + L".yml"sv, + }; + static_assert(is_sorted(checked_extensions.begin(), checked_extensions.end())); + + if (binary_search(checked_extensions.begin(), checked_extensions.end(), filepath.extension().wstring())) { + fwprintf(stderr, L"Validation failed: %ls contains %zu lines with more than %zu columns.\n", + filepath.c_str(), overlength_lines, max_line_length); + } + } } int main() {