forked from hsutter/cppfront
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpure2-bugfix-for-discard-precedence.cpp
More file actions
54 lines (39 loc) · 2.05 KB
/
Copy pathpure2-bugfix-for-discard-precedence.cpp
File metadata and controls
54 lines (39 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#define CPP2_INCLUDE_STD Yes
//=== Cpp2 type declarations ====================================================
#include "cpp2util.h"
#line 1 "pure2-bugfix-for-discard-precedence.cpp2"
class quantity;
#line 2 "pure2-bugfix-for-discard-precedence.cpp2"
//=== Cpp2 type definitions and function declarations ===========================
#line 1 "pure2-bugfix-for-discard-precedence.cpp2"
class quantity {
#line 2 "pure2-bugfix-for-discard-precedence.cpp2"
private: cpp2::i32 number;
public: quantity(cpp2::impl::in<cpp2::i32> x);
#line 3 "pure2-bugfix-for-discard-precedence.cpp2"
public: auto operator=(cpp2::impl::in<cpp2::i32> x) -> quantity& ;
public: [[nodiscard]] auto operator+(quantity const& that) & -> quantity;
public: quantity(quantity const&) = delete; /* No 'that' constructor, suppress copy */
public: auto operator=(quantity const&) -> void = delete;
#line 5 "pure2-bugfix-for-discard-precedence.cpp2"
};
auto main(int const argc_, char** argv_) -> int;
//=== Cpp2 function definitions =================================================
#line 1 "pure2-bugfix-for-discard-precedence.cpp2"
#line 3 "pure2-bugfix-for-discard-precedence.cpp2"
quantity::quantity(cpp2::impl::in<cpp2::i32> x)
: number{ x } { }
#line 3 "pure2-bugfix-for-discard-precedence.cpp2"
auto quantity::operator=(cpp2::impl::in<cpp2::i32> x) -> quantity& {
number = x;
return *this; }
#line 4 "pure2-bugfix-for-discard-precedence.cpp2"
[[nodiscard]] auto quantity::operator+(quantity const& that) & -> quantity { return quantity(number + that.number); }
#line 7 "pure2-bugfix-for-discard-precedence.cpp2"
auto main(int const argc_, char** argv_) -> int{
auto const args = cpp2::make_args(argc_, argv_);
#line 8 "pure2-bugfix-for-discard-precedence.cpp2"
quantity x {1729};
static_cast<void>(x + x);// Not `(void) x + x`; would attempt to add a `void` to `x`.
static_cast<void>(args);// Not `void(args)`; would attempt to declare `args` with `void` type.
}