|
| 1 | + |
| 2 | +#define CPP2_IMPORT_STD Yes |
| 3 | + |
| 4 | +//=== Cpp2 type declarations ==================================================== |
| 5 | + |
| 6 | + |
| 7 | +#include "cpp2util.h" |
| 8 | + |
| 9 | +#line 1 "pure2-bugfix-for-nested-lists.cpp2" |
| 10 | +class point; |
| 11 | +#line 2 "pure2-bugfix-for-nested-lists.cpp2" |
| 12 | + |
| 13 | + |
| 14 | +//=== Cpp2 type definitions and function declarations =========================== |
| 15 | + |
| 16 | +#line 1 "pure2-bugfix-for-nested-lists.cpp2" |
| 17 | +class point { |
| 18 | +#line 2 "pure2-bugfix-for-nested-lists.cpp2" |
| 19 | + public: int x {0}; |
| 20 | + public: int y {0}; |
| 21 | + public: point(cpp2::impl::in<int> x_, cpp2::impl::in<int> y_); |
| 22 | + public: [[nodiscard]] auto operator<=>(point const& that) const& -> std::strong_ordering = default; |
| 23 | +public: point(point const& that); |
| 24 | + |
| 25 | +public: auto operator=(point const& that) -> point& ; |
| 26 | +public: point(point&& that) noexcept; |
| 27 | +public: auto operator=(point&& that) noexcept -> point& ; |
| 28 | +public: explicit point(); |
| 29 | + |
| 30 | +#line 8 "pure2-bugfix-for-nested-lists.cpp2" |
| 31 | +}; |
| 32 | + |
| 33 | +[[nodiscard]] auto check(cpp2::impl::in<point> p) -> auto; |
| 34 | + |
| 35 | +auto main() -> int; |
| 36 | + |
| 37 | +//=== Cpp2 function definitions ================================================= |
| 38 | + |
| 39 | +#line 1 "pure2-bugfix-for-nested-lists.cpp2" |
| 40 | + |
| 41 | +#line 4 "pure2-bugfix-for-nested-lists.cpp2" |
| 42 | + point::point(cpp2::impl::in<int> x_, cpp2::impl::in<int> y_) |
| 43 | + : x{ x_ } |
| 44 | + , y{ y_ }{ |
| 45 | + |
| 46 | +#line 7 "pure2-bugfix-for-nested-lists.cpp2" |
| 47 | + } |
| 48 | + |
| 49 | + |
| 50 | + point::point(point const& that) |
| 51 | + : x{ that.x } |
| 52 | + , y{ that.y }{} |
| 53 | + |
| 54 | +auto point::operator=(point const& that) -> point& { |
| 55 | + x = that.x; |
| 56 | + y = that.y; |
| 57 | + return *this;} |
| 58 | +point::point(point&& that) noexcept |
| 59 | + : x{ std::move(that).x } |
| 60 | + , y{ std::move(that).y }{} |
| 61 | +auto point::operator=(point&& that) noexcept -> point& { |
| 62 | + x = std::move(that).x; |
| 63 | + y = std::move(that).y; |
| 64 | + return *this;} |
| 65 | +point::point(){} |
| 66 | +#line 10 "pure2-bugfix-for-nested-lists.cpp2" |
| 67 | +[[nodiscard]] auto check(cpp2::impl::in<point> p) -> auto { return p; } |
| 68 | + |
| 69 | +#line 12 "pure2-bugfix-for-nested-lists.cpp2" |
| 70 | +auto main() -> int{ |
| 71 | + if (cpp2::cpp2_default.is_active() && !(check({ 17, 29 }).x == 17) ) { cpp2::cpp2_default.report_violation(""); } |
| 72 | + if (cpp2::cpp2_default.is_active() && !(check({ 17, 29 }).y == 29) ) { cpp2::cpp2_default.report_violation(""); } |
| 73 | + |
| 74 | + std::array<std::array<cpp2::u8,3>,3> board {{ { |
| 75 | + 'O', 'X', 'O' }, { |
| 76 | + ' ', { 'X' }, 'X' }, { |
| 77 | + 'X', 'O', 'O' } }}; |
| 78 | + |
| 79 | + if (cpp2::cpp2_default.is_active() && !(CPP2_ASSERT_IN_BOUNDS_LITERAL(board, 0) == std::array<cpp2::u8,3>{'O', 'X', 'O'}) ) { cpp2::cpp2_default.report_violation(""); } |
| 80 | + if (cpp2::cpp2_default.is_active() && !(CPP2_ASSERT_IN_BOUNDS_LITERAL(board, 1) == std::array<cpp2::u8,3>{' ', 'X', 'X'}) ) { cpp2::cpp2_default.report_violation(""); } |
| 81 | + if (cpp2::cpp2_default.is_active() && !(CPP2_ASSERT_IN_BOUNDS_LITERAL(cpp2::move(board), 2) == std::array<cpp2::u8,3>{'X', 'O', 'O'}) ) { cpp2::cpp2_default.report_violation(""); } |
| 82 | + |
| 83 | + // Still parentheses (for now?) |
| 84 | + if (cpp2::cpp2_default.is_active() && !(CPP2_UFCS(size)((std::vector{17, 29})) == 2) ) { cpp2::cpp2_default.report_violation(""); } |
| 85 | +} |
| 86 | + |
0 commit comments