@@ -15,41 +15,42 @@ class quantity;
15
15
#line 1 "pure2-bugfix-for-discard-precedence.cpp2"
16
16
class quantity {
17
17
private: cpp2::i32 number;
18
- public: explicit quantity (cpp2::in<std::in_place_t > i, cpp2::in<cpp2::i32 > x);
19
-
18
+ public: explicit quantity (cpp2::in<cpp2::i32 > x);
19
+
20
+ #line 3 "pure2-bugfix-for-discard-precedence.cpp2"
21
+ public: auto operator =(cpp2::in<cpp2::i32 > x) -> quantity& ;
22
+ public: [[nodiscard]] auto operator +(quantity const & that) -> quantity;
20
23
21
- #line 7 "pure2-bugfix-for-discard-precedence.cpp2"
22
- public: auto operator +=(quantity const & that) -> quantity&;
23
-
24
24
public: quantity(quantity const &) = delete ; /* No 'that' constructor, suppress copy */
25
25
public: auto operator =(quantity const &) -> void = delete ;
26
-
27
-
28
- #line 11 "pure2-bugfix-for-discard-precedence.cpp2"
26
+ #line 5 "pure2-bugfix-for-discard-precedence.cpp2"
29
27
};
30
28
31
- auto main () -> int;
29
+ auto main (int const argc_, char const * const * const argv_ ) -> int;
32
30
33
31
34
32
// === Cpp2 function definitions =================================================
35
33
36
34
37
35
#line 3 "pure2-bugfix-for-discard-precedence.cpp2"
38
- quantity::quantity (cpp2::in<std:: in_place_t > i, cpp2::in< cpp2::i32 > x)
39
- : number{ x }
36
+ quantity::quantity (cpp2::in<cpp2::i32 > x)
37
+ : number{ x }
40
38
#line 3 "pure2-bugfix-for-discard-precedence.cpp2"
41
- {
42
-
43
- static_cast <void >(i);
44
- }
45
- auto quantity::operator +=(quantity const & that) -> quantity&{
46
- number += that.number ;
47
- return (*this );
48
- }
49
-
50
- #line 13 "pure2-bugfix-for-discard-precedence.cpp2"
51
- auto main () -> int{
52
- quantity x {std::in_place, 1729 };
53
- x += std::move (x);
39
+ { }
40
+ #line 3 "pure2-bugfix-for-discard-precedence.cpp2"
41
+ auto quantity::operator =(cpp2::in<cpp2::i32 > x) -> quantity& {
42
+ number = x;
43
+ return *this ;
44
+ #line 3 "pure2-bugfix-for-discard-precedence.cpp2"
45
+ }
46
+ [[nodiscard]] auto quantity::operator +(quantity const & that) -> quantity { return quantity (number + that.number ); }
47
+
48
+ #line 7 "pure2-bugfix-for-discard-precedence.cpp2"
49
+ auto main (int const argc_, char const * const * const argv_) -> int{
50
+ auto args = cpp2::make_args (argc_, argv_);
51
+ #line 8 "pure2-bugfix-for-discard-precedence.cpp2"
52
+ quantity x {1729 };
53
+ static_cast <void >(x + std::move (x));// Not `(void) x + x`; would attempt to add a `void` to `x`.
54
+ static_cast <void >(args);// Not `void(args)`; would attempt to declare `args` with `void` type.
54
55
}
55
56
0 commit comments