8
8
9
9
#line 1 "pure2-print.cpp2"
10
10
11
- #line 4 "pure2-print.cpp2"
11
+ #line 6 "pure2-print.cpp2"
12
12
class outer ;
13
13
14
14
@@ -19,9 +19,11 @@ class outer;
19
19
// Exercise the pretty-print visualizer for the various grammar elements
20
20
21
21
#line 4 "pure2-print.cpp2"
22
+ extern bool testing_enabled;
23
+
22
24
class outer {
23
25
24
- #line 6 "pure2-print.cpp2"
26
+ #line 8 "pure2-print.cpp2"
25
27
public: template <typename T>
26
28
CPP2_REQUIRES_ (true ) static const T object_alias;
27
29
public: class mytype final
@@ -30,16 +32,16 @@ CPP2_REQUIRES_ (true) static const T object_alias;
30
32
31
33
public: [[nodiscard]] virtual auto g (cpp2::in<int > i) const -> int;
32
34
33
- #line 31 "pure2-print.cpp2"
35
+ #line 33 "pure2-print.cpp2"
34
36
private: [[nodiscard]] static auto h (cpp2::in<std::string> s, std::map<int const ,std::string>& m) -> std::string;
35
37
struct values_ret { int offset; std::string name; };
36
38
37
39
38
40
39
- #line 54 "pure2-print.cpp2"
41
+ #line 56 "pure2-print.cpp2"
40
42
public: template <typename T> [[nodiscard]] auto values ([[maybe_unused]] T const & unnamed_param_2) const & -> values_ret;
41
43
42
- #line 59 "pure2-print.cpp2"
44
+ #line 61 "pure2-print.cpp2"
43
45
public: explicit mytype ();
44
46
45
47
public: mytype([[maybe_unused]] mytype const & that);
@@ -48,32 +50,32 @@ struct values_ret { int offset; std::string name; };
48
50
49
51
public: static auto variadic (auto const & ...x) -> void
50
52
CPP2_REQUIRES_ ((std::is_convertible_v<CPP2_TYPEOF(x), int> && ...)) ;
51
- #line 66 "pure2-print.cpp2"
53
+ #line 68 "pure2-print.cpp2"
52
54
};
53
55
54
56
public: static auto test () -> void;
55
57
56
- #line 89 "pure2-print.cpp2"
58
+ #line 91 "pure2-print.cpp2"
57
59
public: template <typename ...Ts> class x {
58
60
private: std::tuple<Ts...> tup {};
59
61
public: x() = default ;
60
62
public: x(x const &) = delete ; /* No 'that' constructor, suppress copy */
61
63
public: auto operator =(x const &) -> void = delete ;
62
64
63
- #line 91 "pure2-print.cpp2"
65
+ #line 93 "pure2-print.cpp2"
64
66
};
65
67
66
68
public: template <typename ...Args> static auto print (std::ostream& out, Args const & ...args) -> void
67
69
CPP2_REQUIRES_ (cpp2::cmp_greater_eq(sizeof (Args)...,0)) ;
68
70
69
- #line 97 "pure2-print.cpp2"
71
+ #line 99 "pure2-print.cpp2"
70
72
public: template <typename ...Args> [[nodiscard]] static auto all (Args const & ...args) -> bool;
71
73
public: outer() = default ;
72
74
public: outer(outer const &) = delete ; /* No 'that' constructor, suppress copy */
73
75
public: auto operator =(outer const &) -> void = delete ;
74
76
75
77
76
- #line 100 "pure2-print.cpp2"
78
+ #line 102 "pure2-print.cpp2"
77
79
};
78
80
79
81
auto main () -> int;
@@ -82,12 +84,15 @@ auto main() -> int;
82
84
83
85
#line 1 "pure2-print.cpp2"
84
86
85
- #line 6 "pure2-print.cpp2"
87
+ #line 4 "pure2-print.cpp2"
88
+ bool testing_enabled {false };
89
+
90
+ #line 8 "pure2-print.cpp2"
86
91
template <typename T>
87
92
requires (true ) inline CPP2_CONSTEXPR T outer::object_alias = 42;
88
- #line 7 "pure2-print.cpp2"
93
+ #line 9 "pure2-print.cpp2"
89
94
90
- #line 10 "pure2-print.cpp2"
95
+ #line 12 "pure2-print.cpp2"
91
96
[[nodiscard]] auto outer::mytype::f () -> int { return 42 ; }
92
97
93
98
[[nodiscard]] auto outer::mytype::g (cpp2::in<int > i) const -> int{
@@ -111,11 +116,11 @@ requires (true) inline CPP2_CONSTEXPR T outer::object_alias = 42;
111
116
112
117
[[nodiscard]] auto outer::mytype::h (cpp2::in<std::string> s, std::map<int const ,std::string>& m) -> std::string
113
118
114
- #line 34 "pure2-print.cpp2"
119
+ #line 36 "pure2-print.cpp2"
115
120
{
116
121
if (cpp2::Default.has_handler () && !(CPP2_UFCS (empty)(m) == false || false ) ) { cpp2::Default.violation (" message" ); }
117
- if (cpp2::Bounds.has_handler () && !([_0 = 0 , _1 = CPP2_UFCS (ssize)(m), _2 = 100 ]{ return cpp2::cmp_less (_0,_1) && cpp2::cmp_less (_1,_2); }() && true != false ) ) { cpp2::Bounds.violation (" " ); }
118
- #line 35 "pure2-print.cpp2"
122
+ if (cpp2::Bounds.has_handler () && testing_enabled && !([_0 = 0 , _1 = CPP2_UFCS (ssize)(m), _2 = 100 ]{ return cpp2::cmp_less (_0,_1) && cpp2::cmp_less (_1,_2); }() && true != false ) ) { cpp2::Bounds.violation (" " ); }
123
+ #line 37 "pure2-print.cpp2"
119
124
auto a {[]() mutable -> void {}};
120
125
auto b {[]() mutable -> void {}};
121
126
auto c {[]() mutable -> void {}};
@@ -124,9 +129,9 @@ requires (true) inline CPP2_CONSTEXPR T outer::object_alias = 42;
124
129
125
130
do {} while ( [&]{ b () ; return true ; }() && CPP2_UFCS (empty)(s));
126
131
127
- for ( [[maybe_unused]] auto const & unnamed_param_1 : m ) { { do {goto CONTINUE_43_13 ; } while (false ); c (); } CPP2_CONTINUE_BREAK (43_13 ) }
132
+ for ( [[maybe_unused]] auto const & unnamed_param_1 : m ) { { do {goto CONTINUE_45_13 ; } while (false ); c (); } CPP2_CONTINUE_BREAK (45_13 ) }
128
133
129
- #line 45 "pure2-print.cpp2"
134
+ #line 47 "pure2-print.cpp2"
130
135
if (cpp2::is (!(CPP2_UFCS (empty)(s)), (true ))) {std::move (a)(); }
131
136
else {if (!(CPP2_UFCS (empty)(m))) {std::move (b)(); }
132
137
else {std::move (c)(); }}
@@ -139,7 +144,7 @@ requires (true) inline CPP2_CONSTEXPR T outer::object_alias = 42;
139
144
template <typename T> [[nodiscard]] auto outer::mytype::values ([[maybe_unused]] T const & unnamed_param_2) const & -> values_ret{
140
145
cpp2::deferred_init<int > offset;
141
146
cpp2::deferred_init<std::string> name;
142
- #line 55 "pure2-print.cpp2"
147
+ #line 57 "pure2-print.cpp2"
143
148
offset.construct (53 );
144
149
name.construct (" plugh" );
145
150
return { std::move (offset.value ()), std::move (name.value ()) }; }
@@ -153,7 +158,7 @@ requires (true) inline CPP2_CONSTEXPR T outer::object_alias = 42;
153
158
auto outer::mytype::variadic (auto const & ...x) -> void
154
159
requires ((std::is_convertible_v<CPP2_TYPEOF(x), int> && ...)) {(std::cout << ... << x); }
155
160
156
- #line 68 "pure2-print.cpp2"
161
+ #line 70 "pure2-print.cpp2"
157
162
auto outer::test () -> void{
158
163
namespace namespace_alias = ::std;
159
164
@@ -165,7 +170,7 @@ requires ((std::is_convertible_v<CPP2_TYPEOF(x), int> && ...)) {(std::cout << ..
165
170
cpp2::i8 constexpr object_alias_1 = 42 ;
166
171
auto constexpr object_alias_2 = 42 ;
167
172
168
- #line 80 "pure2-print.cpp2"
173
+ #line 82 "pure2-print.cpp2"
169
174
::outer::mytype var {};
170
175
cout << CPP2_UFCS (g)(var, 42 ) << " \n " ;
171
176
@@ -175,17 +180,17 @@ requires ((std::is_convertible_v<CPP2_TYPEOF(x), int> && ...)) {(std::cout << ..
175
180
() << " \n " ;
176
181
}
177
182
178
- #line 93 "pure2-print.cpp2"
183
+ #line 95 "pure2-print.cpp2"
179
184
template <typename ...Args> auto outer::print (std::ostream& out, Args const & ...args) -> void
180
185
requires (cpp2::cmp_greater_eq(sizeof (Args)...,0)) {
181
- #line 94 "pure2-print.cpp2"
186
+ #line 96 "pure2-print.cpp2"
182
187
(out << ... << args);
183
188
}
184
189
185
190
template <typename ...Args> [[nodiscard]] auto outer::all (Args const & ...args) -> bool {
186
191
return (... && args); }
187
192
188
- #line 102 "pure2-print.cpp2"
193
+ #line 104 "pure2-print.cpp2"
189
194
auto main () -> int{
190
195
outer::test ();
191
196
}
0 commit comments