|
| 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::in<int> x_, cpp2::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::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::in<int> x_, cpp2::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::in<point> p) -> auto { return p; } |
| 68 | + |
| 69 | +auto main() -> int{ |
| 70 | + if (cpp2::Default.has_handler() && !(check({17, 29}).x == 17) ) { cpp2::Default.report_violation(""); } |
| 71 | + if (cpp2::Default.has_handler() && !(check({17, 29}).y == 29) ) { cpp2::Default.report_violation(""); } |
| 72 | + |
| 73 | + //board: std::array<std::array<u8, 3>, 3> = (( |
| 74 | + // ('O', 'X', 'O'), |
| 75 | + // (' ', 'X', 'X'), |
| 76 | + // ('X', 'O', 'O') |
| 77 | + //)); |
| 78 | + //assert(board[0] == :std::array<u8, 3> = ('O', 'X', 'O')); |
| 79 | + //assert(board[1] == :std::array<u8, 3> = (' ', 'X', 'X')); |
| 80 | + //assert(board[2] == :std::array<u8, 3> = ('X', 'O', 'O')); |
| 81 | + |
| 82 | + // Still parentheses |
| 83 | + if (cpp2::Default.has_handler() && !(CPP2_UFCS(size)((std::vector{17, 29})) == 2) ) { cpp2::Default.report_violation(""); } |
| 84 | +} |
| 85 | + |
0 commit comments