Bug Summary

File:root/firefox-clang/mfbt/tests/TestVariant.cpp
Warning:line 397, column 3
Method called on moved-from object 'v1'

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -O2 -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name TestVariant.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -relaxed-aliasing -ffp-contract=off -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/mfbt/tests -fcoverage-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/mfbt/tests -resource-dir /usr/lib/llvm-23/lib/clang/23 -include /root/firefox-clang/config/gcc_hidden.h -include /root/firefox-clang/obj-x86_64-pc-linux-gnu/mozilla-config.h -D _GLIBCXX_ASSERTIONS=1 -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/system_wrappers -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -D DEBUG=1 -I /root/firefox-clang/mfbt/tests -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/mfbt/tests -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/testing -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nspr -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nss -D MOZILLA_CLIENT -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/x86_64-linux-gnu/c++/16 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/backward -internal-isystem /usr/lib/llvm-23/lib/clang/23/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-error=pessimizing-move -Wno-error=large-by-value-copy=128 -Wno-error=implicit-int-float-conversion -Wno-error=thread-safety-analysis -Wno-error=tautological-type-limit-compare -Wno-invalid-offsetof -Wno-range-loop-analysis -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-error=atomic-alignment -Wno-error=deprecated-builtins -Wno-psabi -Wno-error=builtin-macro-redefined -Wno-vla-cxx-extension -Wno-unknown-warning-option -Wno-character-conversion -std=gnu++20 -fdeprecated-macro -ferror-limit 19 -fstrict-flex-arrays=1 -stack-protector 2 -fstack-clash-protection -ftrivial-auto-var-init=pattern -fno-rtti -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fno-sized-deallocation -fno-aligned-allocation -fdiagnostics-absolute-paths -vectorize-loops -vectorize-slp -analyzer-checker optin.performance.Padding -analyzer-output=html -analyzer-config stable-report-filename=true -mllvm -dwarf-linkage-names=Abstract -faddrsig -fdwarf2-cfi-asm -o /tmp/scan-build-2026-09-01-224014-2642839-1 -x c++ /root/firefox-clang/mfbt/tests/TestVariant.cpp
1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5#include <tuple>
6#include <type_traits>
7
8#include "mozilla/UniquePtr.h"
9#include "mozilla/Variant.h"
10
11using mozilla::MakeUnique;
12using mozilla::UniquePtr;
13using mozilla::Variant;
14
15struct Destroyer {
16 static int destroyedCount;
17 ~Destroyer() { destroyedCount++; }
18};
19
20int Destroyer::destroyedCount = 0;
21
22static void testDetails() {
23 printf("testDetails\n");
24
25 using mozilla::detail::Nth;
26
27 // Test Nth with a list of 1 item.
28 static_assert(std::is_same_v<Nth<0, int>, int>,
29 "Nth<0, int>::Type should be int");
30
31 // Test Nth with a list of more than 1 item.
32 static_assert(std::is_same_v<Nth<0, int, char>, int>,
33 "Nth<0, int, char>::Type should be int");
34 static_assert(std::is_same_v<Nth<1, int, char>, char>,
35 "Nth<1, int, char>::Type should be char");
36
37 using mozilla::detail::SelectVariantType;
38
39 // SelectVariantType for zero items (shouldn't happen, but `count` should
40 // still work ok.)
41 static_assert(SelectVariantType<int, char>::count == 0,
42 "SelectVariantType<int, char>::count should be 0");
43
44 // SelectVariantType for 1 type, for all combinations from/to T, const T,
45 // const T&, T&&
46 // - type to type
47 static_assert(std::is_same_v<typename SelectVariantType<int, int>::Type, int>,
48 "SelectVariantType<int, int>::Type should be int");
49 static_assert(SelectVariantType<int, int>::count == 1,
50 "SelectVariantType<int, int>::count should be 1");
51
52 // - type to const type
53 static_assert(std::is_same_v<typename SelectVariantType<int, const int>::Type,
54 const int>,
55 "SelectVariantType<int, const int>::Type should be const int");
56 static_assert(SelectVariantType<int, const int>::count == 1,
57 "SelectVariantType<int, const int>::count should be 1");
58
59 // - type to const type&
60 static_assert(
61 std::is_same_v<typename SelectVariantType<int, const int&>::Type,
62 const int&>,
63 "SelectVariantType<int, const int&>::Type should be const int&");
64 static_assert(SelectVariantType<int, const int&>::count == 1,
65 "SelectVariantType<int, const int&>::count should be 1");
66
67 // - type to type&&
68 static_assert(
69 std::is_same_v<typename SelectVariantType<int, int&&>::Type, int&&>,
70 "SelectVariantType<int, int&&>::Type should be int&&");
71 static_assert(SelectVariantType<int, int&&>::count == 1,
72 "SelectVariantType<int, int&&>::count should be 1");
73
74 // - const type to type
75 static_assert(
76 std::is_same_v<typename SelectVariantType<const int, int>::Type, int>,
77 "SelectVariantType<const int, int>::Type should be int");
78 static_assert(SelectVariantType<const int, int>::count == 1,
79 "SelectVariantType<const int, int>::count should be 1");
80
81 // - const type to const type
82 static_assert(
83 std::is_same_v<typename SelectVariantType<const int, const int>::Type,
84 const int>,
85 "SelectVariantType<const int, const int>::Type should be const int");
86 static_assert(SelectVariantType<const int, const int>::count == 1,
87 "SelectVariantType<const int, const int>::count should be 1");
88
89 // - const type to const type&
90 static_assert(
91 std::is_same_v<typename SelectVariantType<const int, const int&>::Type,
92 const int&>,
93 "SelectVariantType<const int, const int&>::Type should be const int&");
94 static_assert(SelectVariantType<const int, const int&>::count == 1,
95 "SelectVariantType<const int, const int&>::count should be 1");
96
97 // - const type to type&&
98 static_assert(
99 std::is_same_v<typename SelectVariantType<const int, int&&>::Type, int&&>,
100 "SelectVariantType<const int, int&&>::Type should be int&&");
101 static_assert(SelectVariantType<const int, int&&>::count == 1,
102 "SelectVariantType<const int, int&&>::count should be 1");
103
104 // - const type& to type
105 static_assert(
106 std::is_same_v<typename SelectVariantType<const int&, int>::Type, int>,
107 "SelectVariantType<const int&, int>::Type should be int");
108 static_assert(SelectVariantType<const int&, int>::count == 1,
109 "SelectVariantType<const int&, int>::count should be 1");
110
111 // - const type& to const type
112 static_assert(
113 std::is_same_v<typename SelectVariantType<const int&, const int>::Type,
114 const int>,
115 "SelectVariantType<const int&, const int>::Type should be const int");
116 static_assert(SelectVariantType<const int&, const int>::count == 1,
117 "SelectVariantType<const int&, const int>::count should be 1");
118
119 // - const type& to const type&
120 static_assert(
121 std::is_same_v<typename SelectVariantType<const int&, const int&>::Type,
122 const int&>,
123 "SelectVariantType<const int&, const int&>::Type should be const int&");
124 static_assert(SelectVariantType<const int&, const int&>::count == 1,
125 "SelectVariantType<const int&, const int&>::count should be 1");
126
127 // - const type& to type&&
128 static_assert(
129 std::is_same_v<typename SelectVariantType<const int&, int&&>::Type,
130 int&&>,
131 "SelectVariantType<const int&, int&&>::Type should be int&&");
132 static_assert(SelectVariantType<const int&, int&&>::count == 1,
133 "SelectVariantType<const int&, int&&>::count should be 1");
134
135 // - type&& to type
136 static_assert(
137 std::is_same_v<typename SelectVariantType<int&&, int>::Type, int>,
138 "SelectVariantType<int&&, int>::Type should be int");
139 static_assert(SelectVariantType<int&&, int>::count == 1,
140 "SelectVariantType<int&&, int>::count should be 1");
141
142 // - type&& to const type
143 static_assert(
144 std::is_same_v<typename SelectVariantType<int&&, const int>::Type,
145 const int>,
146 "SelectVariantType<int&&, const int>::Type should be const int");
147 static_assert(SelectVariantType<int&&, const int>::count == 1,
148 "SelectVariantType<int&&, const int>::count should be 1");
149
150 // - type&& to const type&
151 static_assert(
152 std::is_same_v<typename SelectVariantType<int&&, const int&>::Type,
153 const int&>,
154 "SelectVariantType<int&&, const int&>::Type should be const int&");
155 static_assert(SelectVariantType<int&&, const int&>::count == 1,
156 "SelectVariantType<int&&, const int&>::count should be 1");
157
158 // - type&& to type&&
159 static_assert(
160 std::is_same_v<typename SelectVariantType<int&&, int&&>::Type, int&&>,
161 "SelectVariantType<int&&, int&&>::Type should be int&&");
162 static_assert(SelectVariantType<int&&, int&&>::count == 1,
163 "SelectVariantType<int&&, int&&>::count should be 1");
164
165 // SelectVariantType for two different types.
166 // (Don't test all combinations, trust that the above tests are sufficient.)
167 static_assert(
168 std::is_same_v<typename SelectVariantType<int, int, char>::Type, int>,
169 "SelectVariantType<int, int, char>::Type should be int");
170 static_assert(SelectVariantType<int, int, char>::count == 1,
171 "SelectVariantType<int, int, char>::count should be 1");
172 static_assert(
173 std::is_same_v<typename SelectVariantType<char, int, char>::Type, char>,
174 "SelectVariantType<char, int, char>::Type should be char");
175 static_assert(SelectVariantType<char, int, char>::count == 1,
176 "SelectVariantType<char, int, char>::count should be 1");
177
178 // SelectVariantType for two identical types.
179 static_assert(
180 std::is_same_v<typename SelectVariantType<int, int, int>::Type, int>,
181 "SelectVariantType<int, int, int>::Type should be int");
182 static_assert(SelectVariantType<int, int, int>::count == 2,
183 "SelectVariantType<int, int, int>::count should be 2");
184
185 // SelectVariantType for two identical types, with others around.
186 static_assert(
187 std::is_same_v<typename SelectVariantType<int, char, int, int>::Type,
188 int>,
189 "SelectVariantType<int, char, int, int>::Type should be int");
190 static_assert(SelectVariantType<int, char, int, int>::count == 2,
191 "SelectVariantType<int, char, int, int>::count should be 2");
192
193 static_assert(
194 std::is_same_v<typename SelectVariantType<int, int, char, int>::Type,
195 int>,
196 "SelectVariantType<int, int, char, int>::Type should be int");
197 static_assert(SelectVariantType<int, int, char, int>::count == 2,
198 "SelectVariantType<int, int, char, int>::count should be 2");
199
200 static_assert(
201 std::is_same_v<typename SelectVariantType<int, int, int, char>::Type,
202 int>,
203 "SelectVariantType<int, int, int, char>::Type should be int");
204 static_assert(SelectVariantType<int, int, int, char>::count == 2,
205 "SelectVariantType<int, int, int, char>::count should be 2");
206
207 static_assert(
208 std::is_same_v<
209 typename SelectVariantType<int, char, int, char, int, char>::Type,
210 int>,
211 "SelectVariantType<int, char, int, char, int, char>::Type should be int");
212 static_assert(
213 SelectVariantType<int, char, int, char, int, char>::count == 2,
214 "SelectVariantType<int, char, int, char, int, char>::count should be 2");
215
216 // SelectVariantType for two identically-selectable types (first one wins!).
217 static_assert(
218 std::is_same_v<typename SelectVariantType<int, int, const int>::Type,
219 int>,
220 "SelectVariantType<int, int, const int>::Type should be int");
221 static_assert(SelectVariantType<int, int, const int>::count == 2,
222 "SelectVariantType<int, int, const int>::count should be 2");
223 static_assert(
224 std::is_same_v<typename SelectVariantType<int, const int, int>::Type,
225 const int>,
226 "SelectVariantType<int, const int, int>::Type should be const int");
227 static_assert(SelectVariantType<int, const int, int>::count == 2,
228 "SelectVariantType<int, const int, int>::count should be 2");
229 static_assert(
230 std::is_same_v<typename SelectVariantType<int, const int, int&&>::Type,
231 const int>,
232 "SelectVariantType<int, const int, int&&>::Type should be const int");
233 static_assert(SelectVariantType<int, const int, int&&>::count == 2,
234 "SelectVariantType<int, const int, int&&>::count should be 2");
235}
236
237static void testSimple() {
238 printf("testSimple\n");
239 using V = Variant<uint32_t, uint64_t>;
240
241 // Non-const lvalue.
242 V v(uint64_t(1));
243 MOZ_RELEASE_ASSERT(v.is<uint64_t>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v.is<uint64_t>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v.is<uint64_t>()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("v.is<uint64_t>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 243); do {
} while (false); do { MOZ_CrashSequence(__null, 243); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
244 MOZ_RELEASE_ASSERT(!v.is<uint32_t>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!v.is<uint32_t>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!v.is<uint32_t>()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("!v.is<uint32_t>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 244); do {
} while (false); do { MOZ_CrashSequence(__null, 244); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
245 MOZ_RELEASE_ASSERT(v.as<uint64_t>() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v.as<uint64_t>() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v.as<uint64_t>() == 1)
)), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.as<uint64_t>() == 1"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 245); do {
} while (false); do { MOZ_CrashSequence(__null, 245); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
246
247 MOZ_RELEASE_ASSERT(v.is<1>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v.is<1>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v.is<1>()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("v.is<1>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 247); do {
} while (false); do { MOZ_CrashSequence(__null, 247); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
248 MOZ_RELEASE_ASSERT(!v.is<0>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!v.is<0>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!v.is<0>()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("!v.is<0>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 248); do {
} while (false); do { MOZ_CrashSequence(__null, 248); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
249 static_assert(std::is_same_v<decltype(v.as<1>()), uint64_t&>,
250 "v.as<1>() should return a uint64_t&");
251 MOZ_RELEASE_ASSERT(v.as<1>() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v.as<1>() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v.as<1>() == 1))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("v.as<1>() == 1"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 251); do {
} while (false); do { MOZ_CrashSequence(__null, 251); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
252
253 // Const lvalue.
254 const V& cv = v;
255 MOZ_RELEASE_ASSERT(cv.is<uint64_t>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(cv.is<uint64_t>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cv.is<uint64_t>()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("cv.is<uint64_t>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 255); do {
} while (false); do { MOZ_CrashSequence(__null, 255); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
256 MOZ_RELEASE_ASSERT(!cv.is<uint32_t>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!cv.is<uint32_t>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!cv.is<uint32_t>()))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("!cv.is<uint32_t>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 256); do {
} while (false); do { MOZ_CrashSequence(__null, 256); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
257 MOZ_RELEASE_ASSERT(cv.as<uint64_t>() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(cv.as<uint64_t>() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cv.as<uint64_t>() == 1
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"cv.as<uint64_t>() == 1", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 257); do { } while (false); do { MOZ_CrashSequence(__null, 257
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
258
259 MOZ_RELEASE_ASSERT(cv.is<1>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(cv.is<1>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cv.is<1>()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("cv.is<1>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 259); do {
} while (false); do { MOZ_CrashSequence(__null, 259); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
260 MOZ_RELEASE_ASSERT(!cv.is<0>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!cv.is<0>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!cv.is<0>()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("!cv.is<0>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 260); do {
} while (false); do { MOZ_CrashSequence(__null, 260); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
261 static_assert(std::is_same_v<decltype(cv.as<1>()), const uint64_t&>,
262 "cv.as<1>() should return a const uint64_t&");
263 MOZ_RELEASE_ASSERT(cv.as<1>() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(cv.as<1>() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cv.as<1>() == 1))), 0)
)) { do { } while (false); MOZ_ReportAssertionFailure("cv.as<1>() == 1"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 263); do {
} while (false); do { MOZ_CrashSequence(__null, 263); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
264
265 // Non-const rvalue, using a function to create a temporary.
266 auto MakeV = []() { return V(uint64_t(1)); };
267 MOZ_RELEASE_ASSERT(MakeV().is<uint64_t>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(MakeV().is<uint64_t>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(MakeV().is<uint64_t>()
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"MakeV().is<uint64_t>()", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 267); do { } while (false); do { MOZ_CrashSequence(__null, 267
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
268 MOZ_RELEASE_ASSERT(!MakeV().is<uint32_t>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!MakeV().is<uint32_t>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!MakeV().is<uint32_t>(
)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("!MakeV().is<uint32_t>()", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 268); do { } while (false); do { MOZ_CrashSequence(__null, 268
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
269 MOZ_RELEASE_ASSERT(MakeV().as<uint64_t>() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(MakeV().as<uint64_t>() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(MakeV().as<uint64_t>()
== 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("MakeV().as<uint64_t>() == 1", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 269); do { } while (false); do { MOZ_CrashSequence(__null, 269
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
270
271 MOZ_RELEASE_ASSERT(MakeV().is<1>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(MakeV().is<1>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(MakeV().is<1>()))), 0)
)) { do { } while (false); MOZ_ReportAssertionFailure("MakeV().is<1>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 271); do {
} while (false); do { MOZ_CrashSequence(__null, 271); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
272 MOZ_RELEASE_ASSERT(!MakeV().is<0>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!MakeV().is<0>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!MakeV().is<0>()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("!MakeV().is<0>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 272); do {
} while (false); do { MOZ_CrashSequence(__null, 272); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
273 static_assert(std::is_same_v<decltype(MakeV().as<1>()), uint64_t&&>,
274 "MakeV().as<1>() should return a uint64_t&&");
275 MOZ_RELEASE_ASSERT(MakeV().as<1>() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(MakeV().as<1>() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(MakeV().as<1>() == 1))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("MakeV().as<1>() == 1"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 275); do {
} while (false); do { MOZ_CrashSequence(__null, 275); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
276
277 // Const rvalue, using a function to create a temporary.
278 auto MakeCV = []() -> const V { return V(uint64_t(1)); };
279 MOZ_RELEASE_ASSERT(MakeCV().is<uint64_t>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(MakeCV().is<uint64_t>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(MakeCV().is<uint64_t>(
)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("MakeCV().is<uint64_t>()", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 279); do { } while (false); do { MOZ_CrashSequence(__null, 279
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
280 MOZ_RELEASE_ASSERT(!MakeCV().is<uint32_t>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!MakeCV().is<uint32_t>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!MakeCV().is<uint32_t>
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("!MakeCV().is<uint32_t>()", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 280); do { } while (false); do { MOZ_CrashSequence(__null, 280
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
281 MOZ_RELEASE_ASSERT(MakeCV().as<uint64_t>() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(MakeCV().as<uint64_t>() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(MakeCV().as<uint64_t>(
) == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("MakeCV().as<uint64_t>() == 1", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 281); do { } while (false); do { MOZ_CrashSequence(__null, 281
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
282
283 MOZ_RELEASE_ASSERT(MakeCV().is<1>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(MakeCV().is<1>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(MakeCV().is<1>()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("MakeCV().is<1>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 283); do {
} while (false); do { MOZ_CrashSequence(__null, 283); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
284 MOZ_RELEASE_ASSERT(!MakeCV().is<0>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!MakeCV().is<0>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!MakeCV().is<0>()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("!MakeCV().is<0>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 284); do {
} while (false); do { MOZ_CrashSequence(__null, 284); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
285 static_assert(std::is_same_v<decltype(MakeCV().as<1>()), const uint64_t&&>,
286 "MakeCV().as<1>() should return a const uint64_t&&");
287 MOZ_RELEASE_ASSERT(MakeCV().as<1>() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(MakeCV().as<1>() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(MakeCV().as<1>() == 1)
)), 0))) { do { } while (false); MOZ_ReportAssertionFailure("MakeCV().as<1>() == 1"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 287); do {
} while (false); do { MOZ_CrashSequence(__null, 287); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
288}
289
290static void testDuplicate() {
291 printf("testDuplicate\n");
292 Variant<uint32_t, uint64_t, uint32_t> v(uint64_t(1));
293 MOZ_RELEASE_ASSERT(v.is<uint64_t>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v.is<uint64_t>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v.is<uint64_t>()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("v.is<uint64_t>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 293); do {
} while (false); do { MOZ_CrashSequence(__null, 293); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
294 MOZ_RELEASE_ASSERT(v.as<uint64_t>() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v.as<uint64_t>() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v.as<uint64_t>() == 1)
)), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.as<uint64_t>() == 1"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 294); do {
} while (false); do { MOZ_CrashSequence(__null, 294); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
295 // Note: uint32_t is not unique, so `v.is<uint32_t>()` is not allowed.
296
297 MOZ_RELEASE_ASSERT(v.is<1>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v.is<1>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v.is<1>()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("v.is<1>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 297); do {
} while (false); do { MOZ_CrashSequence(__null, 297); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
298 MOZ_RELEASE_ASSERT(!v.is<0>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!v.is<0>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!v.is<0>()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("!v.is<0>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 298); do {
} while (false); do { MOZ_CrashSequence(__null, 298); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
299 MOZ_RELEASE_ASSERT(!v.is<2>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!v.is<2>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!v.is<2>()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("!v.is<2>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 299); do {
} while (false); do { MOZ_CrashSequence(__null, 299); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
300 static_assert(std::is_same_v<decltype(v.as<0>()), uint32_t&>,
301 "as<0>() should return a uint64_t");
302 static_assert(std::is_same_v<decltype(v.as<1>()), uint64_t&>,
303 "as<1>() should return a uint64_t");
304 static_assert(std::is_same_v<decltype(v.as<2>()), uint32_t&>,
305 "as<2>() should return a uint64_t");
306 MOZ_RELEASE_ASSERT(v.as<1>() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v.as<1>() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v.as<1>() == 1))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("v.as<1>() == 1"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 306); do {
} while (false); do { MOZ_CrashSequence(__null, 306); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
307 MOZ_RELEASE_ASSERT(v.extract<1>() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v.extract<1>() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v.extract<1>() == 1)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.extract<1>() == 1"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 307); do {
} while (false); do { MOZ_CrashSequence(__null, 307); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
308}
309
310static void testConstructionWithVariantType() {
311 Variant<uint32_t, uint64_t, uint32_t> v(mozilla::VariantType<uint64_t>{}, 3);
312 MOZ_RELEASE_ASSERT(v.is<uint64_t>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v.is<uint64_t>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v.is<uint64_t>()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("v.is<uint64_t>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 312); do {
} while (false); do { MOZ_CrashSequence(__null, 312); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
313 // MOZ_RELEASE_ASSERT(!v.is<uint32_t>()); // uint32_t is not unique!
314 MOZ_RELEASE_ASSERT(v.as<uint64_t>() == 3)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v.as<uint64_t>() == 3)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v.as<uint64_t>() == 3)
)), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.as<uint64_t>() == 3"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 314); do {
} while (false); do { MOZ_CrashSequence(__null, 314); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
315}
316
317static void testConstructionWithVariantIndex() {
318 Variant<uint32_t, uint64_t, uint32_t> v(mozilla::VariantIndex<2>{}, 2);
319 MOZ_RELEASE_ASSERT(!v.is<uint64_t>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!v.is<uint64_t>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!v.is<uint64_t>()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("!v.is<uint64_t>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 319); do {
} while (false); do { MOZ_CrashSequence(__null, 319); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
320 // Note: uint32_t is not unique, so `v.is<uint32_t>()` is not allowed.
321
322 MOZ_RELEASE_ASSERT(!v.is<1>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!v.is<1>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!v.is<1>()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("!v.is<1>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 322); do {
} while (false); do { MOZ_CrashSequence(__null, 322); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
323 MOZ_RELEASE_ASSERT(!v.is<0>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!v.is<0>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!v.is<0>()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("!v.is<0>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 323); do {
} while (false); do { MOZ_CrashSequence(__null, 323); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
324 MOZ_RELEASE_ASSERT(v.is<2>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v.is<2>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v.is<2>()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("v.is<2>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 324); do {
} while (false); do { MOZ_CrashSequence(__null, 324); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
325 MOZ_RELEASE_ASSERT(v.as<2>() == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v.as<2>() == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v.as<2>() == 2))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("v.as<2>() == 2"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 325); do {
} while (false); do { MOZ_CrashSequence(__null, 325); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
326 MOZ_RELEASE_ASSERT(v.extract<2>() == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v.extract<2>() == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v.extract<2>() == 2)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.extract<2>() == 2"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 326); do {
} while (false); do { MOZ_CrashSequence(__null, 326); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
327}
328
329static void testEmplaceWithType() {
330 printf("testEmplaceWithType\n");
331 Variant<uint32_t, uint64_t, uint32_t> v1(mozilla::VariantIndex<0>{}, 0);
332 v1.emplace<uint64_t>(3);
333 MOZ_RELEASE_ASSERT(v1.is<uint64_t>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.is<uint64_t>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v1.is<uint64_t>()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("v1.is<uint64_t>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 333); do {
} while (false); do { MOZ_CrashSequence(__null, 333); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
334 MOZ_RELEASE_ASSERT(v1.as<uint64_t>() == 3)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.as<uint64_t>() == 3)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v1.as<uint64_t>() == 3
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"v1.as<uint64_t>() == 3", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 334); do { } while (false); do { MOZ_CrashSequence(__null, 334
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
335
336 Variant<UniquePtr<int>, char> v2('a');
337 v2.emplace<UniquePtr<int>>();
338 MOZ_RELEASE_ASSERT(v2.is<UniquePtr<int>>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.is<UniquePtr<int>>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v2.is<UniquePtr<int>>
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v2.is<UniquePtr<int>>()", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 338); do { } while (false); do { MOZ_CrashSequence(__null, 338
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
339 MOZ_RELEASE_ASSERT(!v2.as<UniquePtr<int>>().get())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!v2.as<UniquePtr<int>>().get())>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(!v2.as<UniquePtr<int>>().get()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("!v2.as<UniquePtr<int>>().get()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 339); do {
} while (false); do { MOZ_CrashSequence(__null, 339); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
340
341 Variant<UniquePtr<int>, char> v3('a');
342 v3.emplace<UniquePtr<int>>(MakeUnique<int>(4));
343 MOZ_RELEASE_ASSERT(v3.is<UniquePtr<int>>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.is<UniquePtr<int>>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v3.is<UniquePtr<int>>
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v3.is<UniquePtr<int>>()", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 343); do { } while (false); do { MOZ_CrashSequence(__null, 343
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
344 MOZ_RELEASE_ASSERT(*v3.as<UniquePtr<int>>().get() == 4)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*v3.as<UniquePtr<int>>().get() == 4)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(*v3.as<UniquePtr<int>>().get() == 4))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("*v3.as<UniquePtr<int>>().get() == 4"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 344); do {
} while (false); do { MOZ_CrashSequence(__null, 344); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
345}
346
347static void testEmplaceWithIndex() {
348 printf("testEmplaceWithIndex\n");
349 Variant<uint32_t, uint64_t, uint32_t> v1(mozilla::VariantIndex<1>{}, 0);
350 v1.emplace<2>(2);
351 MOZ_RELEASE_ASSERT(!v1.is<uint64_t>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!v1.is<uint64_t>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!v1.is<uint64_t>()))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("!v1.is<uint64_t>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 351); do {
} while (false); do { MOZ_CrashSequence(__null, 351); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
352 MOZ_RELEASE_ASSERT(!v1.is<1>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!v1.is<1>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!v1.is<1>()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("!v1.is<1>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 352); do {
} while (false); do { MOZ_CrashSequence(__null, 352); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
353 MOZ_RELEASE_ASSERT(!v1.is<0>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!v1.is<0>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!v1.is<0>()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("!v1.is<0>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 353); do {
} while (false); do { MOZ_CrashSequence(__null, 353); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
354 MOZ_RELEASE_ASSERT(v1.is<2>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.is<2>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v1.is<2>()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("v1.is<2>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 354); do {
} while (false); do { MOZ_CrashSequence(__null, 354); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
355 MOZ_RELEASE_ASSERT(v1.as<2>() == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.as<2>() == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v1.as<2>() == 2))), 0)
)) { do { } while (false); MOZ_ReportAssertionFailure("v1.as<2>() == 2"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 355); do {
} while (false); do { MOZ_CrashSequence(__null, 355); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
356 MOZ_RELEASE_ASSERT(v1.extract<2>() == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.extract<2>() == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v1.extract<2>() == 2))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v1.extract<2>() == 2"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 356); do {
} while (false); do { MOZ_CrashSequence(__null, 356); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
357
358 Variant<UniquePtr<int>, char> v2('a');
359 v2.emplace<0>();
360 MOZ_RELEASE_ASSERT(v2.is<UniquePtr<int>>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.is<UniquePtr<int>>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v2.is<UniquePtr<int>>
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v2.is<UniquePtr<int>>()", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 360); do { } while (false); do { MOZ_CrashSequence(__null, 360
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
361 MOZ_RELEASE_ASSERT(!v2.is<1>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!v2.is<1>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!v2.is<1>()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("!v2.is<1>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 361); do {
} while (false); do { MOZ_CrashSequence(__null, 361); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
362 MOZ_RELEASE_ASSERT(v2.is<0>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.is<0>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v2.is<0>()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("v2.is<0>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 362); do {
} while (false); do { MOZ_CrashSequence(__null, 362); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
363 MOZ_RELEASE_ASSERT(!v2.as<0>().get())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!v2.as<0>().get())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!v2.as<0>().get()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("!v2.as<0>().get()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 363); do {
} while (false); do { MOZ_CrashSequence(__null, 363); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
364 MOZ_RELEASE_ASSERT(!v2.extract<0>().get())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!v2.extract<0>().get())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!v2.extract<0>().get()
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"!v2.extract<0>().get()", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 364); do { } while (false); do { MOZ_CrashSequence(__null, 364
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
365
366 Variant<UniquePtr<int>, char> v3('a');
367 v3.emplace<0>(MakeUnique<int>(4));
368 MOZ_RELEASE_ASSERT(v3.is<UniquePtr<int>>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.is<UniquePtr<int>>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v3.is<UniquePtr<int>>
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v3.is<UniquePtr<int>>()", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 368); do { } while (false); do { MOZ_CrashSequence(__null, 368
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
369 MOZ_RELEASE_ASSERT(!v3.is<1>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!v3.is<1>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!v3.is<1>()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("!v3.is<1>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 369); do {
} while (false); do { MOZ_CrashSequence(__null, 369); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
370 MOZ_RELEASE_ASSERT(v3.is<0>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.is<0>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v3.is<0>()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("v3.is<0>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 370); do {
} while (false); do { MOZ_CrashSequence(__null, 370); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
371 MOZ_RELEASE_ASSERT(*v3.as<0>().get() == 4)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*v3.as<0>().get() == 4)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*v3.as<0>().get() == 4
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"*v3.as<0>().get() == 4", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 371); do { } while (false); do { MOZ_CrashSequence(__null, 371
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
372 MOZ_RELEASE_ASSERT(*v3.extract<0>().get() == 4)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*v3.extract<0>().get() == 4)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*v3.extract<0>().get()
== 4))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("*v3.extract<0>().get() == 4", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 372); do { } while (false); do { MOZ_CrashSequence(__null, 372
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
373}
374
375static void testCopy() {
376 printf("testCopy\n");
377 Variant<uint32_t, uint64_t> v1(uint64_t(1));
378 Variant<uint32_t, uint64_t> v2(v1);
379 MOZ_RELEASE_ASSERT(v2.is<uint64_t>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.is<uint64_t>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v2.is<uint64_t>()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("v2.is<uint64_t>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 379); do {
} while (false); do { MOZ_CrashSequence(__null, 379); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
380 MOZ_RELEASE_ASSERT(!v2.is<uint32_t>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!v2.is<uint32_t>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!v2.is<uint32_t>()))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("!v2.is<uint32_t>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 380); do {
} while (false); do { MOZ_CrashSequence(__null, 380); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
381 MOZ_RELEASE_ASSERT(v2.as<uint64_t>() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.as<uint64_t>() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v2.as<uint64_t>() == 1
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"v2.as<uint64_t>() == 1", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 381); do { } while (false); do { MOZ_CrashSequence(__null, 381
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
382
383 Variant<uint32_t, uint64_t> v3(uint32_t(10));
384 v3 = v2;
385 MOZ_RELEASE_ASSERT(v3.is<uint64_t>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.is<uint64_t>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v3.is<uint64_t>()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("v3.is<uint64_t>()"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 385); do {
} while (false); do { MOZ_CrashSequence(__null, 385); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
386 MOZ_RELEASE_ASSERT(v3.as<uint64_t>() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.as<uint64_t>() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v3.as<uint64_t>() == 1
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"v3.as<uint64_t>() == 1", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 386); do { } while (false); do { MOZ_CrashSequence(__null, 386
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
387}
388
389static void testMove() {
390 printf("testMove\n");
391 Variant<UniquePtr<int>, char> v1(MakeUnique<int>(5));
392 Variant<UniquePtr<int>, char> v2(std::move(v1));
2
Object 'v1' is moved
393
394 MOZ_RELEASE_ASSERT(v2.is<UniquePtr<int>>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.is<UniquePtr<int>>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v2.is<UniquePtr<int>>
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v2.is<UniquePtr<int>>()", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 394); do { } while (false); do { MOZ_CrashSequence(__null, 394
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
3
Taking false branch
4
Loop condition is false. Exiting loop
395 MOZ_RELEASE_ASSERT(*v2.as<UniquePtr<int>>() == 5)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*v2.as<UniquePtr<int>>() == 5)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(*v2.as<UniquePtr<int>>() == 5))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("*v2.as<UniquePtr<int>>() == 5"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 395); do {
} while (false); do { MOZ_CrashSequence(__null, 395); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
5
Assuming the condition is true
6
Taking false branch
7
Loop condition is false. Exiting loop
396
397 MOZ_RELEASE_ASSERT(v1.is<UniquePtr<int>>())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.is<UniquePtr<int>>())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v1.is<UniquePtr<int>>
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v1.is<UniquePtr<int>>()", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 397); do { } while (false); do { MOZ_CrashSequence(__null, 397
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
8
Method called on moved-from object 'v1'
398 MOZ_RELEASE_ASSERT(v1.as<UniquePtr<int>>() == nullptr)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.as<UniquePtr<int>>() == nullptr)>::
isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v1.as<UniquePtr<int>>() == nullptr))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("v1.as<UniquePtr<int>>() == nullptr"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 398); do {
} while (false); do { MOZ_CrashSequence(__null, 398); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
399
400 Destroyer::destroyedCount = 0;
401 {
402 Variant<char, UniquePtr<Destroyer>> v3(MakeUnique<Destroyer>());
403 Variant<char, UniquePtr<Destroyer>> v4(std::move(v3));
404
405 Variant<char, UniquePtr<Destroyer>> v5('a');
406 v5 = std::move(v4);
407
408 auto ptr = v5.extract<UniquePtr<Destroyer>>();
409 MOZ_RELEASE_ASSERT(Destroyer::destroyedCount == 0)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Destroyer::destroyedCount == 0)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(Destroyer::destroyedCount ==
0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("Destroyer::destroyedCount == 0", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 409); do { } while (false); do { MOZ_CrashSequence(__null, 409
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
410 }
411 MOZ_RELEASE_ASSERT(Destroyer::destroyedCount == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Destroyer::destroyedCount == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(Destroyer::destroyedCount ==
1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("Destroyer::destroyedCount == 1", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 411); do { } while (false); do { MOZ_CrashSequence(__null, 411
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
412}
413
414static void testDestructor() {
415 printf("testDestructor\n");
416 Destroyer::destroyedCount = 0;
417
418 {
419 Destroyer d;
420
421 {
422 Variant<char, UniquePtr<char[]>, Destroyer> v1(d);
423 MOZ_RELEASE_ASSERT(Destroyer::destroyedCount ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Destroyer::destroyedCount == 0)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(Destroyer::destroyedCount ==
0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("Destroyer::destroyedCount == 0", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 424); do { } while (false); do { MOZ_CrashSequence(__null, 424
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
424 0)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Destroyer::destroyedCount == 0)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(Destroyer::destroyedCount ==
0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("Destroyer::destroyedCount == 0", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 424); do { } while (false); do { MOZ_CrashSequence(__null, 424
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
; // None destroyed yet.
425 }
426
427 MOZ_RELEASE_ASSERT(Destroyer::destroyedCount ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Destroyer::destroyedCount == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(Destroyer::destroyedCount ==
1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("Destroyer::destroyedCount == 1", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 428); do { } while (false); do { MOZ_CrashSequence(__null, 428
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
428 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Destroyer::destroyedCount == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(Destroyer::destroyedCount ==
1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("Destroyer::destroyedCount == 1", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 428); do { } while (false); do { MOZ_CrashSequence(__null, 428
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
; // v1's copy of d is destroyed.
429
430 {
431 Variant<char, UniquePtr<char[]>, Destroyer> v2(
432 mozilla::VariantIndex<2>{});
433 v2.emplace<Destroyer>(d);
434 MOZ_RELEASE_ASSERT(Destroyer::destroyedCount ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Destroyer::destroyedCount == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(Destroyer::destroyedCount ==
2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("Destroyer::destroyedCount == 2", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 435); do { } while (false); do { MOZ_CrashSequence(__null, 435
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
435 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Destroyer::destroyedCount == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(Destroyer::destroyedCount ==
2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("Destroyer::destroyedCount == 2", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 435); do { } while (false); do { MOZ_CrashSequence(__null, 435
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
; // v2's initial value is destroyed.
436 }
437
438 MOZ_RELEASE_ASSERT(Destroyer::destroyedCount ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Destroyer::destroyedCount == 3)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(Destroyer::destroyedCount ==
3))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("Destroyer::destroyedCount == 3", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 439); do { } while (false); do { MOZ_CrashSequence(__null, 439
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
439 3)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Destroyer::destroyedCount == 3)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(Destroyer::destroyedCount ==
3))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("Destroyer::destroyedCount == 3", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 439); do { } while (false); do { MOZ_CrashSequence(__null, 439
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
; // v2's second value is destroyed.
440 }
441
442 MOZ_RELEASE_ASSERT(Destroyer::destroyedCount == 4)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Destroyer::destroyedCount == 4)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(Destroyer::destroyedCount ==
4))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("Destroyer::destroyedCount == 4", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 442); do { } while (false); do { MOZ_CrashSequence(__null, 442
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
; // d is destroyed.
443}
444
445static void testEquality() {
446 printf("testEquality\n");
447 using V = Variant<char, int>;
448
449 V v0('a');
450 V v1('b');
451 V v2('b');
452 V v3(42);
453 V v4(27);
454 V v5(27);
455 V v6(int('b'));
456
457 MOZ_RELEASE_ASSERT(v0 != v1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v0 != v1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v0 != v1))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v0 != v1", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 457); do { } while (false); do { MOZ_CrashSequence(__null, 457
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
458 MOZ_RELEASE_ASSERT(v1 == v2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1 == v2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v1 == v2))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v1 == v2", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 458); do { } while (false); do { MOZ_CrashSequence(__null, 458
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
459 MOZ_RELEASE_ASSERT(v2 != v3)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2 != v3)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v2 != v3))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v2 != v3", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 459); do { } while (false); do { MOZ_CrashSequence(__null, 459
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
460 MOZ_RELEASE_ASSERT(v3 != v4)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3 != v4)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v3 != v4))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v3 != v4", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 460); do { } while (false); do { MOZ_CrashSequence(__null, 460
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
461 MOZ_RELEASE_ASSERT(v4 == v5)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v4 == v5)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v4 == v5))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v4 == v5", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 461); do { } while (false); do { MOZ_CrashSequence(__null, 461
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
462 MOZ_RELEASE_ASSERT(v1 != v6)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1 != v6)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v1 != v6))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v1 != v6", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 462); do { } while (false); do { MOZ_CrashSequence(__null, 462
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
463
464 MOZ_RELEASE_ASSERT(v0 == v0)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v0 == v0)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v0 == v0))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v0 == v0", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 464); do { } while (false); do { MOZ_CrashSequence(__null, 464
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
465 MOZ_RELEASE_ASSERT(v1 == v1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1 == v1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v1 == v1))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v1 == v1", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 465); do { } while (false); do { MOZ_CrashSequence(__null, 465
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
466 MOZ_RELEASE_ASSERT(v2 == v2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2 == v2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v2 == v2))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v2 == v2", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 466); do { } while (false); do { MOZ_CrashSequence(__null, 466
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
467 MOZ_RELEASE_ASSERT(v3 == v3)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3 == v3)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v3 == v3))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v3 == v3", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 467); do { } while (false); do { MOZ_CrashSequence(__null, 467
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
468 MOZ_RELEASE_ASSERT(v4 == v4)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v4 == v4)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v4 == v4))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v4 == v4", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 468); do { } while (false); do { MOZ_CrashSequence(__null, 468
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
469 MOZ_RELEASE_ASSERT(v5 == v5)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v5 == v5)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v5 == v5))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v5 == v5", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 469); do { } while (false); do { MOZ_CrashSequence(__null, 469
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
470 MOZ_RELEASE_ASSERT(v6 == v6)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v6 == v6)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v6 == v6))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v6 == v6", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 470); do { } while (false); do { MOZ_CrashSequence(__null, 470
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
471}
472
473// Matcher that returns a description of how its call-operator was invoked.
474struct Describer {
475 enum class ParameterSize { NA, U8, U32, U64 };
476 enum class ParameterQualifier {
477 NA,
478 ParamLREF,
479 ParamCLREF,
480 ParamRREF,
481 ParamCRREF
482 };
483 enum class ThisQualifier { NA, ThisLREF, ThisCLREF, ThisRREF, ThisCRREF };
484
485 using Result =
486 std::tuple<ParameterSize, ParameterQualifier, ThisQualifier, uint64_t>;
487
488#define RESULT(SIZE, PQUAL, TQUAL, VALUE) \
489 Describer::Result(Describer::ParameterSize::SIZE, \
490 Describer::ParameterQualifier::PQUAL, \
491 Describer::ThisQualifier::TQUAL, VALUE)
492
493#define CALL(TYPE, SIZE, PQUAL, TREF, TQUAL) \
494 Result operator()(TYPE aValue) TREF { \
495 return RESULT(SIZE, PQUAL, TQUAL, aValue); \
496 }
497
498 // All combinations of possible call operators:
499 // Every line, the parameter integer type changes.
500 // Every 3 lines, the parameter type changes constness.
501 // Every 6 lines, the parameter changes reference l/r-valueness.
502 // Every 12 lines, the member function qualifier changes constness.
503 // After 24 lines, the member function qualifier changes ref l/r-valueness.
504 CALL(uint8_t&, U8, ParamLREF, &, ThisLREF)
505 CALL(uint32_t&, U32, ParamLREF, &, ThisLREF)
506 CALL(uint64_t&, U64, ParamLREF, &, ThisLREF)
507
508 CALL(const uint8_t&, U8, ParamCLREF, &, ThisLREF)
509 CALL(const uint32_t&, U32, ParamCLREF, &, ThisLREF)
510 CALL(const uint64_t&, U64, ParamCLREF, &, ThisLREF)
511
512 CALL(uint8_t&&, U8, ParamRREF, &, ThisLREF)
513 CALL(uint32_t&&, U32, ParamRREF, &, ThisLREF)
514 CALL(uint64_t&&, U64, ParamRREF, &, ThisLREF)
515
516 CALL(const uint8_t&&, U8, ParamCRREF, &, ThisLREF)
517 CALL(const uint32_t&&, U32, ParamCRREF, &, ThisLREF)
518 CALL(const uint64_t&&, U64, ParamCRREF, &, ThisLREF)
519
520 CALL(uint8_t&, U8, ParamLREF, const&, ThisCLREF)
521 CALL(uint32_t&, U32, ParamLREF, const&, ThisCLREF)
522 CALL(uint64_t&, U64, ParamLREF, const&, ThisCLREF)
523
524 CALL(const uint8_t&, U8, ParamCLREF, const&, ThisCLREF)
525 CALL(const uint32_t&, U32, ParamCLREF, const&, ThisCLREF)
526 CALL(const uint64_t&, U64, ParamCLREF, const&, ThisCLREF)
527
528 CALL(uint8_t&&, U8, ParamRREF, const&, ThisCLREF)
529 CALL(uint32_t&&, U32, ParamRREF, const&, ThisCLREF)
530 CALL(uint64_t&&, U64, ParamRREF, const&, ThisCLREF)
531
532 CALL(const uint8_t&&, U8, ParamCRREF, const&, ThisCLREF)
533 CALL(const uint32_t&&, U32, ParamCRREF, const&, ThisCLREF)
534 CALL(const uint64_t&&, U64, ParamCRREF, const&, ThisCLREF)
535
536 CALL(uint8_t&, U8, ParamLREF, &&, ThisRREF)
537 CALL(uint32_t&, U32, ParamLREF, &&, ThisRREF)
538 CALL(uint64_t&, U64, ParamLREF, &&, ThisRREF)
539
540 CALL(const uint8_t&, U8, ParamCLREF, &&, ThisRREF)
541 CALL(const uint32_t&, U32, ParamCLREF, &&, ThisRREF)
542 CALL(const uint64_t&, U64, ParamCLREF, &&, ThisRREF)
543
544 CALL(uint8_t&&, U8, ParamRREF, &&, ThisRREF)
545 CALL(uint32_t&&, U32, ParamRREF, &&, ThisRREF)
546 CALL(uint64_t&&, U64, ParamRREF, &&, ThisRREF)
547
548 CALL(const uint8_t&&, U8, ParamCRREF, &&, ThisRREF)
549 CALL(const uint32_t&&, U32, ParamCRREF, &&, ThisRREF)
550 CALL(const uint64_t&&, U64, ParamCRREF, &&, ThisRREF)
551
552 CALL(uint8_t&, U8, ParamLREF, const&&, ThisCRREF)
553 CALL(uint32_t&, U32, ParamLREF, const&&, ThisCRREF)
554 CALL(uint64_t&, U64, ParamLREF, const&&, ThisCRREF)
555
556 CALL(const uint8_t&, U8, ParamCLREF, const&&, ThisCRREF)
557 CALL(const uint32_t&, U32, ParamCLREF, const&&, ThisCRREF)
558 CALL(const uint64_t&, U64, ParamCLREF, const&&, ThisCRREF)
559
560 CALL(uint8_t&&, U8, ParamRREF, const&&, ThisCRREF)
561 CALL(uint32_t&&, U32, ParamRREF, const&&, ThisCRREF)
562 CALL(uint64_t&&, U64, ParamRREF, const&&, ThisCRREF)
563
564 CALL(const uint8_t&&, U8, ParamCRREF, const&&, ThisCRREF)
565 CALL(const uint32_t&&, U32, ParamCRREF, const&&, ThisCRREF)
566 CALL(const uint64_t&&, U64, ParamCRREF, const&&, ThisCRREF)
567
568#undef CALL
569
570 // Catch-all, to verify that there is no call with any type other than the
571 // expected ones above.
572 template <typename Other>
573 Result operator()(const Other&) {
574 MOZ_RELEASE_ASSERT(false)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(false)>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(false))), 0))) { do { } while (
false); MOZ_ReportAssertionFailure("false", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 574); do { } while (false); do { MOZ_CrashSequence(__null, 574
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
575 return RESULT(NA, NA, NA, 0);
576 }
577};
578
579static void testMatching() {
580 printf("testMatching\n");
581 using V = Variant<uint8_t, uint32_t, uint64_t>;
582
583 Describer desc;
584 const Describer descConst;
585 auto MakeDescriber = []() { return Describer(); };
586 auto MakeConstDescriber = []() -> const Describer { return Describer(); };
587
588 V v1(uint8_t(1));
589 V v2(uint32_t(2));
590 V v3(uint64_t(3));
591
592 const V& constRef1 = v1;
593 const V& constRef2 = v2;
594 const V& constRef3 = v3;
595
596 // Create a temporary variant by returning a copy of one.
597 auto CopyV = [](const V& aV) { return aV; };
598
599 // Create a temporary variant by returning a const copy of one.
600 auto CopyConstV = [](const V& aV) -> const V { return aV; };
601
602 // All combinations of possible calls:
603 // Every line, the variant integer type changes.
604 // Every 3 lines, the variant type changes constness.
605 // Every 6 lines, the variant changes reference l/r-valueness.
606 // Every 12 lines, the matcher changes constness.
607 // After 24 lines, the matcher changes ref l/r-valueness.
608 MOZ_RELEASE_ASSERT(v1.match(desc) == RESULT(U8, ParamLREF, ThisLREF, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.match(desc) == RESULT(U8, ParamLREF, ThisLREF, 1)
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v1.match(desc) == RESULT(U8, ParamLREF, ThisLREF, 1)
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"v1.match(desc) == RESULT(U8, ParamLREF, ThisLREF, 1)", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 608); do { } while (false); do { MOZ_CrashSequence(__null, 608
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
609 MOZ_RELEASE_ASSERT(v2.match(desc) == RESULT(U32, ParamLREF, ThisLREF, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.match(desc) == RESULT(U32, ParamLREF, ThisLREF, 2
))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v2.match(desc) == RESULT(U32, ParamLREF, ThisLREF, 2
)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v2.match(desc) == RESULT(U32, ParamLREF, ThisLREF, 2)", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 609); do { } while (false); do { MOZ_CrashSequence(__null, 609
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
610 MOZ_RELEASE_ASSERT(v3.match(desc) == RESULT(U64, ParamLREF, ThisLREF, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.match(desc) == RESULT(U64, ParamLREF, ThisLREF, 3
))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v3.match(desc) == RESULT(U64, ParamLREF, ThisLREF, 3
)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v3.match(desc) == RESULT(U64, ParamLREF, ThisLREF, 3)", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 610); do { } while (false); do { MOZ_CrashSequence(__null, 610
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
611
612 MOZ_RELEASE_ASSERT(constRef1.match(desc) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef1.match(desc) == RESULT(U8, ParamCLREF, ThisLREF
, 1))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(constRef1.match(desc) == RESULT(U8, ParamCLREF, ThisLREF
, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("constRef1.match(desc) == RESULT(U8, ParamCLREF, ThisLREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 613); do {
} while (false); do { MOZ_CrashSequence(__null, 613); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
613 RESULT(U8, ParamCLREF, ThisLREF, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef1.match(desc) == RESULT(U8, ParamCLREF, ThisLREF
, 1))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(constRef1.match(desc) == RESULT(U8, ParamCLREF, ThisLREF
, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("constRef1.match(desc) == RESULT(U8, ParamCLREF, ThisLREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 613); do {
} while (false); do { MOZ_CrashSequence(__null, 613); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
614 MOZ_RELEASE_ASSERT(constRef2.match(desc) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef2.match(desc) == RESULT(U32, ParamCLREF, ThisLREF
, 2))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(constRef2.match(desc) == RESULT(U32, ParamCLREF, ThisLREF
, 2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("constRef2.match(desc) == RESULT(U32, ParamCLREF, ThisLREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 615); do {
} while (false); do { MOZ_CrashSequence(__null, 615); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
615 RESULT(U32, ParamCLREF, ThisLREF, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef2.match(desc) == RESULT(U32, ParamCLREF, ThisLREF
, 2))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(constRef2.match(desc) == RESULT(U32, ParamCLREF, ThisLREF
, 2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("constRef2.match(desc) == RESULT(U32, ParamCLREF, ThisLREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 615); do {
} while (false); do { MOZ_CrashSequence(__null, 615); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
616 MOZ_RELEASE_ASSERT(constRef3.match(desc) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef3.match(desc) == RESULT(U64, ParamCLREF, ThisLREF
, 3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(constRef3.match(desc) == RESULT(U64, ParamCLREF, ThisLREF
, 3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("constRef3.match(desc) == RESULT(U64, ParamCLREF, ThisLREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 617); do {
} while (false); do { MOZ_CrashSequence(__null, 617); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
617 RESULT(U64, ParamCLREF, ThisLREF, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef3.match(desc) == RESULT(U64, ParamCLREF, ThisLREF
, 3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(constRef3.match(desc) == RESULT(U64, ParamCLREF, ThisLREF
, 3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("constRef3.match(desc) == RESULT(U64, ParamCLREF, ThisLREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 617); do {
} while (false); do { MOZ_CrashSequence(__null, 617); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
618
619 MOZ_RELEASE_ASSERT(CopyV(v1).match(desc) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v1).match(desc) == RESULT(U8, ParamRREF, ThisLREF
, 1))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyV(v1).match(desc) == RESULT(U8, ParamRREF, ThisLREF
, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyV(v1).match(desc) == RESULT(U8, ParamRREF, ThisLREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 620); do {
} while (false); do { MOZ_CrashSequence(__null, 620); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
620 RESULT(U8, ParamRREF, ThisLREF, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v1).match(desc) == RESULT(U8, ParamRREF, ThisLREF
, 1))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyV(v1).match(desc) == RESULT(U8, ParamRREF, ThisLREF
, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyV(v1).match(desc) == RESULT(U8, ParamRREF, ThisLREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 620); do {
} while (false); do { MOZ_CrashSequence(__null, 620); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
621 MOZ_RELEASE_ASSERT(CopyV(v2).match(desc) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v2).match(desc) == RESULT(U32, ParamRREF, ThisLREF
, 2))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyV(v2).match(desc) == RESULT(U32, ParamRREF, ThisLREF
, 2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyV(v2).match(desc) == RESULT(U32, ParamRREF, ThisLREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 622); do {
} while (false); do { MOZ_CrashSequence(__null, 622); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
622 RESULT(U32, ParamRREF, ThisLREF, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v2).match(desc) == RESULT(U32, ParamRREF, ThisLREF
, 2))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyV(v2).match(desc) == RESULT(U32, ParamRREF, ThisLREF
, 2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyV(v2).match(desc) == RESULT(U32, ParamRREF, ThisLREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 622); do {
} while (false); do { MOZ_CrashSequence(__null, 622); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
623 MOZ_RELEASE_ASSERT(CopyV(v3).match(desc) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v3).match(desc) == RESULT(U64, ParamRREF, ThisLREF
, 3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyV(v3).match(desc) == RESULT(U64, ParamRREF, ThisLREF
, 3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyV(v3).match(desc) == RESULT(U64, ParamRREF, ThisLREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 624); do {
} while (false); do { MOZ_CrashSequence(__null, 624); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
624 RESULT(U64, ParamRREF, ThisLREF, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v3).match(desc) == RESULT(U64, ParamRREF, ThisLREF
, 3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyV(v3).match(desc) == RESULT(U64, ParamRREF, ThisLREF
, 3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyV(v3).match(desc) == RESULT(U64, ParamRREF, ThisLREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 624); do {
} while (false); do { MOZ_CrashSequence(__null, 624); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
625
626 MOZ_RELEASE_ASSERT(CopyConstV(v1).match(desc) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v1).match(desc) == RESULT(U8, ParamCRREF,
ThisLREF, 1))>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(CopyConstV(v1).match(desc) == RESULT
(U8, ParamCRREF, ThisLREF, 1)))), 0))) { do { } while (false)
; MOZ_ReportAssertionFailure("CopyConstV(v1).match(desc) == RESULT(U8, ParamCRREF, ThisLREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 627); do {
} while (false); do { MOZ_CrashSequence(__null, 627); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
627 RESULT(U8, ParamCRREF, ThisLREF, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v1).match(desc) == RESULT(U8, ParamCRREF,
ThisLREF, 1))>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(CopyConstV(v1).match(desc) == RESULT
(U8, ParamCRREF, ThisLREF, 1)))), 0))) { do { } while (false)
; MOZ_ReportAssertionFailure("CopyConstV(v1).match(desc) == RESULT(U8, ParamCRREF, ThisLREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 627); do {
} while (false); do { MOZ_CrashSequence(__null, 627); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
628 MOZ_RELEASE_ASSERT(CopyConstV(v2).match(desc) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v2).match(desc) == RESULT(U32, ParamCRREF
, ThisLREF, 2))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(CopyConstV(v2).match(desc) == RESULT
(U32, ParamCRREF, ThisLREF, 2)))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("CopyConstV(v2).match(desc) == RESULT(U32, ParamCRREF, ThisLREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 629); do {
} while (false); do { MOZ_CrashSequence(__null, 629); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
629 RESULT(U32, ParamCRREF, ThisLREF, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v2).match(desc) == RESULT(U32, ParamCRREF
, ThisLREF, 2))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(CopyConstV(v2).match(desc) == RESULT
(U32, ParamCRREF, ThisLREF, 2)))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("CopyConstV(v2).match(desc) == RESULT(U32, ParamCRREF, ThisLREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 629); do {
} while (false); do { MOZ_CrashSequence(__null, 629); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
630 MOZ_RELEASE_ASSERT(CopyConstV(v3).match(desc) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v3).match(desc) == RESULT(U64, ParamCRREF
, ThisLREF, 3))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(CopyConstV(v3).match(desc) == RESULT
(U64, ParamCRREF, ThisLREF, 3)))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("CopyConstV(v3).match(desc) == RESULT(U64, ParamCRREF, ThisLREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 631); do {
} while (false); do { MOZ_CrashSequence(__null, 631); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
631 RESULT(U64, ParamCRREF, ThisLREF, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v3).match(desc) == RESULT(U64, ParamCRREF
, ThisLREF, 3))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(CopyConstV(v3).match(desc) == RESULT
(U64, ParamCRREF, ThisLREF, 3)))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("CopyConstV(v3).match(desc) == RESULT(U64, ParamCRREF, ThisLREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 631); do {
} while (false); do { MOZ_CrashSequence(__null, 631); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
632
633 MOZ_RELEASE_ASSERT(v1.match(descConst) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.match(descConst) == RESULT(U8, ParamLREF, ThisCLREF
, 1))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v1.match(descConst) == RESULT(U8, ParamLREF, ThisCLREF
, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v1.match(descConst) == RESULT(U8, ParamLREF, ThisCLREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 634); do {
} while (false); do { MOZ_CrashSequence(__null, 634); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
634 RESULT(U8, ParamLREF, ThisCLREF, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.match(descConst) == RESULT(U8, ParamLREF, ThisCLREF
, 1))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v1.match(descConst) == RESULT(U8, ParamLREF, ThisCLREF
, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v1.match(descConst) == RESULT(U8, ParamLREF, ThisCLREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 634); do {
} while (false); do { MOZ_CrashSequence(__null, 634); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
635 MOZ_RELEASE_ASSERT(v2.match(descConst) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.match(descConst) == RESULT(U32, ParamLREF, ThisCLREF
, 2))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v2.match(descConst) == RESULT(U32, ParamLREF, ThisCLREF
, 2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v2.match(descConst) == RESULT(U32, ParamLREF, ThisCLREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 636); do {
} while (false); do { MOZ_CrashSequence(__null, 636); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
636 RESULT(U32, ParamLREF, ThisCLREF, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.match(descConst) == RESULT(U32, ParamLREF, ThisCLREF
, 2))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v2.match(descConst) == RESULT(U32, ParamLREF, ThisCLREF
, 2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v2.match(descConst) == RESULT(U32, ParamLREF, ThisCLREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 636); do {
} while (false); do { MOZ_CrashSequence(__null, 636); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
637 MOZ_RELEASE_ASSERT(v3.match(descConst) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.match(descConst) == RESULT(U64, ParamLREF, ThisCLREF
, 3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v3.match(descConst) == RESULT(U64, ParamLREF, ThisCLREF
, 3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v3.match(descConst) == RESULT(U64, ParamLREF, ThisCLREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 638); do {
} while (false); do { MOZ_CrashSequence(__null, 638); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
638 RESULT(U64, ParamLREF, ThisCLREF, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.match(descConst) == RESULT(U64, ParamLREF, ThisCLREF
, 3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v3.match(descConst) == RESULT(U64, ParamLREF, ThisCLREF
, 3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v3.match(descConst) == RESULT(U64, ParamLREF, ThisCLREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 638); do {
} while (false); do { MOZ_CrashSequence(__null, 638); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
639
640 MOZ_RELEASE_ASSERT(constRef1.match(descConst) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef1.match(descConst) == RESULT(U8, ParamCLREF,
ThisCLREF, 1))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(constRef1.match(descConst) == RESULT
(U8, ParamCLREF, ThisCLREF, 1)))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("constRef1.match(descConst) == RESULT(U8, ParamCLREF, ThisCLREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 641); do {
} while (false); do { MOZ_CrashSequence(__null, 641); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
641 RESULT(U8, ParamCLREF, ThisCLREF, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef1.match(descConst) == RESULT(U8, ParamCLREF,
ThisCLREF, 1))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(constRef1.match(descConst) == RESULT
(U8, ParamCLREF, ThisCLREF, 1)))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("constRef1.match(descConst) == RESULT(U8, ParamCLREF, ThisCLREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 641); do {
} while (false); do { MOZ_CrashSequence(__null, 641); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
642 MOZ_RELEASE_ASSERT(constRef2.match(descConst) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef2.match(descConst) == RESULT(U32, ParamCLREF
, ThisCLREF, 2))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(constRef2.match(descConst) ==
RESULT(U32, ParamCLREF, ThisCLREF, 2)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("constRef2.match(descConst) == RESULT(U32, ParamCLREF, ThisCLREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 643); do {
} while (false); do { MOZ_CrashSequence(__null, 643); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
643 RESULT(U32, ParamCLREF, ThisCLREF, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef2.match(descConst) == RESULT(U32, ParamCLREF
, ThisCLREF, 2))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(constRef2.match(descConst) ==
RESULT(U32, ParamCLREF, ThisCLREF, 2)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("constRef2.match(descConst) == RESULT(U32, ParamCLREF, ThisCLREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 643); do {
} while (false); do { MOZ_CrashSequence(__null, 643); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
644 MOZ_RELEASE_ASSERT(constRef3.match(descConst) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef3.match(descConst) == RESULT(U64, ParamCLREF
, ThisCLREF, 3))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(constRef3.match(descConst) ==
RESULT(U64, ParamCLREF, ThisCLREF, 3)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("constRef3.match(descConst) == RESULT(U64, ParamCLREF, ThisCLREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 645); do {
} while (false); do { MOZ_CrashSequence(__null, 645); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
645 RESULT(U64, ParamCLREF, ThisCLREF, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef3.match(descConst) == RESULT(U64, ParamCLREF
, ThisCLREF, 3))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(constRef3.match(descConst) ==
RESULT(U64, ParamCLREF, ThisCLREF, 3)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("constRef3.match(descConst) == RESULT(U64, ParamCLREF, ThisCLREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 645); do {
} while (false); do { MOZ_CrashSequence(__null, 645); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
646
647 MOZ_RELEASE_ASSERT(CopyV(v1).match(descConst) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v1).match(descConst) == RESULT(U8, ParamRREF, ThisCLREF
, 1))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyV(v1).match(descConst) == RESULT(U8, ParamRREF, ThisCLREF
, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyV(v1).match(descConst) == RESULT(U8, ParamRREF, ThisCLREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 648); do {
} while (false); do { MOZ_CrashSequence(__null, 648); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
648 RESULT(U8, ParamRREF, ThisCLREF, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v1).match(descConst) == RESULT(U8, ParamRREF, ThisCLREF
, 1))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyV(v1).match(descConst) == RESULT(U8, ParamRREF, ThisCLREF
, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyV(v1).match(descConst) == RESULT(U8, ParamRREF, ThisCLREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 648); do {
} while (false); do { MOZ_CrashSequence(__null, 648); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
649 MOZ_RELEASE_ASSERT(CopyV(v2).match(descConst) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v2).match(descConst) == RESULT(U32, ParamRREF,
ThisCLREF, 2))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(CopyV(v2).match(descConst) == RESULT
(U32, ParamRREF, ThisCLREF, 2)))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("CopyV(v2).match(descConst) == RESULT(U32, ParamRREF, ThisCLREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 650); do {
} while (false); do { MOZ_CrashSequence(__null, 650); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
650 RESULT(U32, ParamRREF, ThisCLREF, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v2).match(descConst) == RESULT(U32, ParamRREF,
ThisCLREF, 2))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(CopyV(v2).match(descConst) == RESULT
(U32, ParamRREF, ThisCLREF, 2)))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("CopyV(v2).match(descConst) == RESULT(U32, ParamRREF, ThisCLREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 650); do {
} while (false); do { MOZ_CrashSequence(__null, 650); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
651 MOZ_RELEASE_ASSERT(CopyV(v3).match(descConst) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v3).match(descConst) == RESULT(U64, ParamRREF,
ThisCLREF, 3))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(CopyV(v3).match(descConst) == RESULT
(U64, ParamRREF, ThisCLREF, 3)))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("CopyV(v3).match(descConst) == RESULT(U64, ParamRREF, ThisCLREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 652); do {
} while (false); do { MOZ_CrashSequence(__null, 652); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
652 RESULT(U64, ParamRREF, ThisCLREF, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v3).match(descConst) == RESULT(U64, ParamRREF,
ThisCLREF, 3))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(CopyV(v3).match(descConst) == RESULT
(U64, ParamRREF, ThisCLREF, 3)))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("CopyV(v3).match(descConst) == RESULT(U64, ParamRREF, ThisCLREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 652); do {
} while (false); do { MOZ_CrashSequence(__null, 652); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
653
654 MOZ_RELEASE_ASSERT(CopyConstV(v1).match(descConst) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v1).match(descConst) == RESULT(U8, ParamCRREF
, ThisCLREF, 1))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(CopyConstV(v1).match(descConst
) == RESULT(U8, ParamCRREF, ThisCLREF, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyConstV(v1).match(descConst) == RESULT(U8, ParamCRREF, ThisCLREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 655); do {
} while (false); do { MOZ_CrashSequence(__null, 655); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
655 RESULT(U8, ParamCRREF, ThisCLREF, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v1).match(descConst) == RESULT(U8, ParamCRREF
, ThisCLREF, 1))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(CopyConstV(v1).match(descConst
) == RESULT(U8, ParamCRREF, ThisCLREF, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyConstV(v1).match(descConst) == RESULT(U8, ParamCRREF, ThisCLREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 655); do {
} while (false); do { MOZ_CrashSequence(__null, 655); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
656 MOZ_RELEASE_ASSERT(CopyConstV(v2).match(descConst) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v2).match(descConst) == RESULT(U32, ParamCRREF
, ThisCLREF, 2))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(CopyConstV(v2).match(descConst
) == RESULT(U32, ParamCRREF, ThisCLREF, 2)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyConstV(v2).match(descConst) == RESULT(U32, ParamCRREF, ThisCLREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 657); do {
} while (false); do { MOZ_CrashSequence(__null, 657); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
657 RESULT(U32, ParamCRREF, ThisCLREF, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v2).match(descConst) == RESULT(U32, ParamCRREF
, ThisCLREF, 2))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(CopyConstV(v2).match(descConst
) == RESULT(U32, ParamCRREF, ThisCLREF, 2)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyConstV(v2).match(descConst) == RESULT(U32, ParamCRREF, ThisCLREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 657); do {
} while (false); do { MOZ_CrashSequence(__null, 657); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
658 MOZ_RELEASE_ASSERT(CopyConstV(v3).match(descConst) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v3).match(descConst) == RESULT(U64, ParamCRREF
, ThisCLREF, 3))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(CopyConstV(v3).match(descConst
) == RESULT(U64, ParamCRREF, ThisCLREF, 3)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyConstV(v3).match(descConst) == RESULT(U64, ParamCRREF, ThisCLREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 659); do {
} while (false); do { MOZ_CrashSequence(__null, 659); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
659 RESULT(U64, ParamCRREF, ThisCLREF, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v3).match(descConst) == RESULT(U64, ParamCRREF
, ThisCLREF, 3))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(CopyConstV(v3).match(descConst
) == RESULT(U64, ParamCRREF, ThisCLREF, 3)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyConstV(v3).match(descConst) == RESULT(U64, ParamCRREF, ThisCLREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 659); do {
} while (false); do { MOZ_CrashSequence(__null, 659); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
660
661 MOZ_RELEASE_ASSERT(v1.match(MakeDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.match(MakeDescriber()) == RESULT(U8, ParamLREF, ThisRREF
, 1))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v1.match(MakeDescriber()) == RESULT(U8, ParamLREF, ThisRREF
, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v1.match(MakeDescriber()) == RESULT(U8, ParamLREF, ThisRREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 662); do {
} while (false); do { MOZ_CrashSequence(__null, 662); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
662 RESULT(U8, ParamLREF, ThisRREF, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.match(MakeDescriber()) == RESULT(U8, ParamLREF, ThisRREF
, 1))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v1.match(MakeDescriber()) == RESULT(U8, ParamLREF, ThisRREF
, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v1.match(MakeDescriber()) == RESULT(U8, ParamLREF, ThisRREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 662); do {
} while (false); do { MOZ_CrashSequence(__null, 662); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
663 MOZ_RELEASE_ASSERT(v2.match(MakeDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.match(MakeDescriber()) == RESULT(U32, ParamLREF, ThisRREF
, 2))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v2.match(MakeDescriber()) == RESULT(U32, ParamLREF, ThisRREF
, 2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v2.match(MakeDescriber()) == RESULT(U32, ParamLREF, ThisRREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 664); do {
} while (false); do { MOZ_CrashSequence(__null, 664); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
664 RESULT(U32, ParamLREF, ThisRREF, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.match(MakeDescriber()) == RESULT(U32, ParamLREF, ThisRREF
, 2))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v2.match(MakeDescriber()) == RESULT(U32, ParamLREF, ThisRREF
, 2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v2.match(MakeDescriber()) == RESULT(U32, ParamLREF, ThisRREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 664); do {
} while (false); do { MOZ_CrashSequence(__null, 664); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
665 MOZ_RELEASE_ASSERT(v3.match(MakeDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.match(MakeDescriber()) == RESULT(U64, ParamLREF, ThisRREF
, 3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v3.match(MakeDescriber()) == RESULT(U64, ParamLREF, ThisRREF
, 3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v3.match(MakeDescriber()) == RESULT(U64, ParamLREF, ThisRREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 666); do {
} while (false); do { MOZ_CrashSequence(__null, 666); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
666 RESULT(U64, ParamLREF, ThisRREF, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.match(MakeDescriber()) == RESULT(U64, ParamLREF, ThisRREF
, 3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v3.match(MakeDescriber()) == RESULT(U64, ParamLREF, ThisRREF
, 3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v3.match(MakeDescriber()) == RESULT(U64, ParamLREF, ThisRREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 666); do {
} while (false); do { MOZ_CrashSequence(__null, 666); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
667
668 MOZ_RELEASE_ASSERT(constRef1.match(MakeDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef1.match(MakeDescriber()) == RESULT(U8, ParamCLREF
, ThisRREF, 1))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(constRef1.match(MakeDescriber(
)) == RESULT(U8, ParamCLREF, ThisRREF, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("constRef1.match(MakeDescriber()) == RESULT(U8, ParamCLREF, ThisRREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 669); do {
} while (false); do { MOZ_CrashSequence(__null, 669); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
669 RESULT(U8, ParamCLREF, ThisRREF, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef1.match(MakeDescriber()) == RESULT(U8, ParamCLREF
, ThisRREF, 1))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(constRef1.match(MakeDescriber(
)) == RESULT(U8, ParamCLREF, ThisRREF, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("constRef1.match(MakeDescriber()) == RESULT(U8, ParamCLREF, ThisRREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 669); do {
} while (false); do { MOZ_CrashSequence(__null, 669); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
670 MOZ_RELEASE_ASSERT(constRef2.match(MakeDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef2.match(MakeDescriber()) == RESULT(U32, ParamCLREF
, ThisRREF, 2))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(constRef2.match(MakeDescriber(
)) == RESULT(U32, ParamCLREF, ThisRREF, 2)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("constRef2.match(MakeDescriber()) == RESULT(U32, ParamCLREF, ThisRREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 671); do {
} while (false); do { MOZ_CrashSequence(__null, 671); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
671 RESULT(U32, ParamCLREF, ThisRREF, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef2.match(MakeDescriber()) == RESULT(U32, ParamCLREF
, ThisRREF, 2))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(constRef2.match(MakeDescriber(
)) == RESULT(U32, ParamCLREF, ThisRREF, 2)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("constRef2.match(MakeDescriber()) == RESULT(U32, ParamCLREF, ThisRREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 671); do {
} while (false); do { MOZ_CrashSequence(__null, 671); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
672 MOZ_RELEASE_ASSERT(constRef3.match(MakeDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef3.match(MakeDescriber()) == RESULT(U64, ParamCLREF
, ThisRREF, 3))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(constRef3.match(MakeDescriber(
)) == RESULT(U64, ParamCLREF, ThisRREF, 3)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("constRef3.match(MakeDescriber()) == RESULT(U64, ParamCLREF, ThisRREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 673); do {
} while (false); do { MOZ_CrashSequence(__null, 673); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
673 RESULT(U64, ParamCLREF, ThisRREF, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef3.match(MakeDescriber()) == RESULT(U64, ParamCLREF
, ThisRREF, 3))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(constRef3.match(MakeDescriber(
)) == RESULT(U64, ParamCLREF, ThisRREF, 3)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("constRef3.match(MakeDescriber()) == RESULT(U64, ParamCLREF, ThisRREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 673); do {
} while (false); do { MOZ_CrashSequence(__null, 673); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
674
675 MOZ_RELEASE_ASSERT(CopyV(v1).match(MakeDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v1).match(MakeDescriber()) == RESULT(U8, ParamRREF
, ThisRREF, 1))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(CopyV(v1).match(MakeDescriber(
)) == RESULT(U8, ParamRREF, ThisRREF, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v1).match(MakeDescriber()) == RESULT(U8, ParamRREF, ThisRREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 676); do {
} while (false); do { MOZ_CrashSequence(__null, 676); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
676 RESULT(U8, ParamRREF, ThisRREF, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v1).match(MakeDescriber()) == RESULT(U8, ParamRREF
, ThisRREF, 1))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(CopyV(v1).match(MakeDescriber(
)) == RESULT(U8, ParamRREF, ThisRREF, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v1).match(MakeDescriber()) == RESULT(U8, ParamRREF, ThisRREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 676); do {
} while (false); do { MOZ_CrashSequence(__null, 676); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
677 MOZ_RELEASE_ASSERT(CopyV(v2).match(MakeDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v2).match(MakeDescriber()) == RESULT(U32, ParamRREF
, ThisRREF, 2))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(CopyV(v2).match(MakeDescriber(
)) == RESULT(U32, ParamRREF, ThisRREF, 2)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v2).match(MakeDescriber()) == RESULT(U32, ParamRREF, ThisRREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 678); do {
} while (false); do { MOZ_CrashSequence(__null, 678); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
678 RESULT(U32, ParamRREF, ThisRREF, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v2).match(MakeDescriber()) == RESULT(U32, ParamRREF
, ThisRREF, 2))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(CopyV(v2).match(MakeDescriber(
)) == RESULT(U32, ParamRREF, ThisRREF, 2)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v2).match(MakeDescriber()) == RESULT(U32, ParamRREF, ThisRREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 678); do {
} while (false); do { MOZ_CrashSequence(__null, 678); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
679 MOZ_RELEASE_ASSERT(CopyV(v3).match(MakeDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v3).match(MakeDescriber()) == RESULT(U64, ParamRREF
, ThisRREF, 3))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(CopyV(v3).match(MakeDescriber(
)) == RESULT(U64, ParamRREF, ThisRREF, 3)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v3).match(MakeDescriber()) == RESULT(U64, ParamRREF, ThisRREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 680); do {
} while (false); do { MOZ_CrashSequence(__null, 680); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
680 RESULT(U64, ParamRREF, ThisRREF, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v3).match(MakeDescriber()) == RESULT(U64, ParamRREF
, ThisRREF, 3))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(CopyV(v3).match(MakeDescriber(
)) == RESULT(U64, ParamRREF, ThisRREF, 3)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v3).match(MakeDescriber()) == RESULT(U64, ParamRREF, ThisRREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 680); do {
} while (false); do { MOZ_CrashSequence(__null, 680); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
681
682 MOZ_RELEASE_ASSERT(CopyConstV(v1).match(MakeDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v1).match(MakeDescriber()) == RESULT(U8, ParamCRREF
, ThisRREF, 1))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(CopyConstV(v1).match(MakeDescriber
()) == RESULT(U8, ParamCRREF, ThisRREF, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyConstV(v1).match(MakeDescriber()) == RESULT(U8, ParamCRREF, ThisRREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 683); do {
} while (false); do { MOZ_CrashSequence(__null, 683); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
683 RESULT(U8, ParamCRREF, ThisRREF, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v1).match(MakeDescriber()) == RESULT(U8, ParamCRREF
, ThisRREF, 1))>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(CopyConstV(v1).match(MakeDescriber
()) == RESULT(U8, ParamCRREF, ThisRREF, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyConstV(v1).match(MakeDescriber()) == RESULT(U8, ParamCRREF, ThisRREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 683); do {
} while (false); do { MOZ_CrashSequence(__null, 683); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
684 MOZ_RELEASE_ASSERT(CopyConstV(v2).match(MakeDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v2).match(MakeDescriber()) == RESULT(U32,
ParamCRREF, ThisRREF, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v2).match(MakeDescriber
()) == RESULT(U32, ParamCRREF, ThisRREF, 2)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v2).match(MakeDescriber()) == RESULT(U32, ParamCRREF, ThisRREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 685); do {
} while (false); do { MOZ_CrashSequence(__null, 685); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
685 RESULT(U32, ParamCRREF, ThisRREF, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v2).match(MakeDescriber()) == RESULT(U32,
ParamCRREF, ThisRREF, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v2).match(MakeDescriber
()) == RESULT(U32, ParamCRREF, ThisRREF, 2)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v2).match(MakeDescriber()) == RESULT(U32, ParamCRREF, ThisRREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 685); do {
} while (false); do { MOZ_CrashSequence(__null, 685); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
686 MOZ_RELEASE_ASSERT(CopyConstV(v3).match(MakeDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v3).match(MakeDescriber()) == RESULT(U64,
ParamCRREF, ThisRREF, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v3).match(MakeDescriber
()) == RESULT(U64, ParamCRREF, ThisRREF, 3)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v3).match(MakeDescriber()) == RESULT(U64, ParamCRREF, ThisRREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 687); do {
} while (false); do { MOZ_CrashSequence(__null, 687); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
687 RESULT(U64, ParamCRREF, ThisRREF, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v3).match(MakeDescriber()) == RESULT(U64,
ParamCRREF, ThisRREF, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v3).match(MakeDescriber
()) == RESULT(U64, ParamCRREF, ThisRREF, 3)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v3).match(MakeDescriber()) == RESULT(U64, ParamCRREF, ThisRREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 687); do {
} while (false); do { MOZ_CrashSequence(__null, 687); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
688
689 MOZ_RELEASE_ASSERT(v1.match(MakeConstDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.match(MakeConstDescriber()) == RESULT(U8, ParamLREF
, ThisCRREF, 1))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(v1.match(MakeConstDescriber()
) == RESULT(U8, ParamLREF, ThisCRREF, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v1.match(MakeConstDescriber()) == RESULT(U8, ParamLREF, ThisCRREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 690); do {
} while (false); do { MOZ_CrashSequence(__null, 690); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
690 RESULT(U8, ParamLREF, ThisCRREF, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.match(MakeConstDescriber()) == RESULT(U8, ParamLREF
, ThisCRREF, 1))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(v1.match(MakeConstDescriber()
) == RESULT(U8, ParamLREF, ThisCRREF, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v1.match(MakeConstDescriber()) == RESULT(U8, ParamLREF, ThisCRREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 690); do {
} while (false); do { MOZ_CrashSequence(__null, 690); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
691 MOZ_RELEASE_ASSERT(v2.match(MakeConstDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.match(MakeConstDescriber()) == RESULT(U32, ParamLREF
, ThisCRREF, 2))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(v2.match(MakeConstDescriber()
) == RESULT(U32, ParamLREF, ThisCRREF, 2)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v2.match(MakeConstDescriber()) == RESULT(U32, ParamLREF, ThisCRREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 692); do {
} while (false); do { MOZ_CrashSequence(__null, 692); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
692 RESULT(U32, ParamLREF, ThisCRREF, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.match(MakeConstDescriber()) == RESULT(U32, ParamLREF
, ThisCRREF, 2))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(v2.match(MakeConstDescriber()
) == RESULT(U32, ParamLREF, ThisCRREF, 2)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v2.match(MakeConstDescriber()) == RESULT(U32, ParamLREF, ThisCRREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 692); do {
} while (false); do { MOZ_CrashSequence(__null, 692); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
693 MOZ_RELEASE_ASSERT(v3.match(MakeConstDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.match(MakeConstDescriber()) == RESULT(U64, ParamLREF
, ThisCRREF, 3))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(v3.match(MakeConstDescriber()
) == RESULT(U64, ParamLREF, ThisCRREF, 3)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v3.match(MakeConstDescriber()) == RESULT(U64, ParamLREF, ThisCRREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 694); do {
} while (false); do { MOZ_CrashSequence(__null, 694); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
694 RESULT(U64, ParamLREF, ThisCRREF, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.match(MakeConstDescriber()) == RESULT(U64, ParamLREF
, ThisCRREF, 3))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(v3.match(MakeConstDescriber()
) == RESULT(U64, ParamLREF, ThisCRREF, 3)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v3.match(MakeConstDescriber()) == RESULT(U64, ParamLREF, ThisCRREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 694); do {
} while (false); do { MOZ_CrashSequence(__null, 694); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
695
696 MOZ_RELEASE_ASSERT(constRef1.match(MakeConstDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef1.match(MakeConstDescriber()) == RESULT(U8, ParamCLREF
, ThisCRREF, 1))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(constRef1.match(MakeConstDescriber
()) == RESULT(U8, ParamCLREF, ThisCRREF, 1)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("constRef1.match(MakeConstDescriber()) == RESULT(U8, ParamCLREF, ThisCRREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 697); do {
} while (false); do { MOZ_CrashSequence(__null, 697); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
697 RESULT(U8, ParamCLREF, ThisCRREF, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef1.match(MakeConstDescriber()) == RESULT(U8, ParamCLREF
, ThisCRREF, 1))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(constRef1.match(MakeConstDescriber
()) == RESULT(U8, ParamCLREF, ThisCRREF, 1)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("constRef1.match(MakeConstDescriber()) == RESULT(U8, ParamCLREF, ThisCRREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 697); do {
} while (false); do { MOZ_CrashSequence(__null, 697); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
698 MOZ_RELEASE_ASSERT(constRef2.match(MakeConstDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef2.match(MakeConstDescriber()) == RESULT(U32,
ParamCLREF, ThisCRREF, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(constRef2.match(MakeConstDescriber
()) == RESULT(U32, ParamCLREF, ThisCRREF, 2)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("constRef2.match(MakeConstDescriber()) == RESULT(U32, ParamCLREF, ThisCRREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 699); do {
} while (false); do { MOZ_CrashSequence(__null, 699); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
699 RESULT(U32, ParamCLREF, ThisCRREF, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef2.match(MakeConstDescriber()) == RESULT(U32,
ParamCLREF, ThisCRREF, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(constRef2.match(MakeConstDescriber
()) == RESULT(U32, ParamCLREF, ThisCRREF, 2)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("constRef2.match(MakeConstDescriber()) == RESULT(U32, ParamCLREF, ThisCRREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 699); do {
} while (false); do { MOZ_CrashSequence(__null, 699); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
700 MOZ_RELEASE_ASSERT(constRef3.match(MakeConstDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef3.match(MakeConstDescriber()) == RESULT(U64,
ParamCLREF, ThisCRREF, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(constRef3.match(MakeConstDescriber
()) == RESULT(U64, ParamCLREF, ThisCRREF, 3)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("constRef3.match(MakeConstDescriber()) == RESULT(U64, ParamCLREF, ThisCRREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 701); do {
} while (false); do { MOZ_CrashSequence(__null, 701); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
701 RESULT(U64, ParamCLREF, ThisCRREF, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef3.match(MakeConstDescriber()) == RESULT(U64,
ParamCLREF, ThisCRREF, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(constRef3.match(MakeConstDescriber
()) == RESULT(U64, ParamCLREF, ThisCRREF, 3)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("constRef3.match(MakeConstDescriber()) == RESULT(U64, ParamCLREF, ThisCRREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 701); do {
} while (false); do { MOZ_CrashSequence(__null, 701); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
702
703 MOZ_RELEASE_ASSERT(CopyV(v1).match(MakeConstDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v1).match(MakeConstDescriber()) == RESULT(U8, ParamRREF
, ThisCRREF, 1))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(CopyV(v1).match(MakeConstDescriber
()) == RESULT(U8, ParamRREF, ThisCRREF, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v1).match(MakeConstDescriber()) == RESULT(U8, ParamRREF, ThisCRREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 704); do {
} while (false); do { MOZ_CrashSequence(__null, 704); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
704 RESULT(U8, ParamRREF, ThisCRREF, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v1).match(MakeConstDescriber()) == RESULT(U8, ParamRREF
, ThisCRREF, 1))>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(CopyV(v1).match(MakeConstDescriber
()) == RESULT(U8, ParamRREF, ThisCRREF, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v1).match(MakeConstDescriber()) == RESULT(U8, ParamRREF, ThisCRREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 704); do {
} while (false); do { MOZ_CrashSequence(__null, 704); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
705 MOZ_RELEASE_ASSERT(CopyV(v2).match(MakeConstDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v2).match(MakeConstDescriber()) == RESULT(U32,
ParamRREF, ThisCRREF, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyV(v2).match(MakeConstDescriber
()) == RESULT(U32, ParamRREF, ThisCRREF, 2)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyV(v2).match(MakeConstDescriber()) == RESULT(U32, ParamRREF, ThisCRREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 706); do {
} while (false); do { MOZ_CrashSequence(__null, 706); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
706 RESULT(U32, ParamRREF, ThisCRREF, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v2).match(MakeConstDescriber()) == RESULT(U32,
ParamRREF, ThisCRREF, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyV(v2).match(MakeConstDescriber
()) == RESULT(U32, ParamRREF, ThisCRREF, 2)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyV(v2).match(MakeConstDescriber()) == RESULT(U32, ParamRREF, ThisCRREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 706); do {
} while (false); do { MOZ_CrashSequence(__null, 706); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
707 MOZ_RELEASE_ASSERT(CopyV(v3).match(MakeConstDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v3).match(MakeConstDescriber()) == RESULT(U64,
ParamRREF, ThisCRREF, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyV(v3).match(MakeConstDescriber
()) == RESULT(U64, ParamRREF, ThisCRREF, 3)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyV(v3).match(MakeConstDescriber()) == RESULT(U64, ParamRREF, ThisCRREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 708); do {
} while (false); do { MOZ_CrashSequence(__null, 708); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
708 RESULT(U64, ParamRREF, ThisCRREF, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v3).match(MakeConstDescriber()) == RESULT(U64,
ParamRREF, ThisCRREF, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyV(v3).match(MakeConstDescriber
()) == RESULT(U64, ParamRREF, ThisCRREF, 3)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyV(v3).match(MakeConstDescriber()) == RESULT(U64, ParamRREF, ThisCRREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 708); do {
} while (false); do { MOZ_CrashSequence(__null, 708); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
709
710 MOZ_RELEASE_ASSERT(CopyConstV(v1).match(MakeConstDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v1).match(MakeConstDescriber()) == RESULT
(U8, ParamCRREF, ThisCRREF, 1))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v1).match(MakeConstDescriber
()) == RESULT(U8, ParamCRREF, ThisCRREF, 1)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v1).match(MakeConstDescriber()) == RESULT(U8, ParamCRREF, ThisCRREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 711); do {
} while (false); do { MOZ_CrashSequence(__null, 711); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
711 RESULT(U8, ParamCRREF, ThisCRREF, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v1).match(MakeConstDescriber()) == RESULT
(U8, ParamCRREF, ThisCRREF, 1))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v1).match(MakeConstDescriber
()) == RESULT(U8, ParamCRREF, ThisCRREF, 1)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v1).match(MakeConstDescriber()) == RESULT(U8, ParamCRREF, ThisCRREF, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 711); do {
} while (false); do { MOZ_CrashSequence(__null, 711); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
712 MOZ_RELEASE_ASSERT(CopyConstV(v2).match(MakeConstDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v2).match(MakeConstDescriber()) == RESULT
(U32, ParamCRREF, ThisCRREF, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v2).match(MakeConstDescriber
()) == RESULT(U32, ParamCRREF, ThisCRREF, 2)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v2).match(MakeConstDescriber()) == RESULT(U32, ParamCRREF, ThisCRREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 713); do {
} while (false); do { MOZ_CrashSequence(__null, 713); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
713 RESULT(U32, ParamCRREF, ThisCRREF, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v2).match(MakeConstDescriber()) == RESULT
(U32, ParamCRREF, ThisCRREF, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v2).match(MakeConstDescriber
()) == RESULT(U32, ParamCRREF, ThisCRREF, 2)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v2).match(MakeConstDescriber()) == RESULT(U32, ParamCRREF, ThisCRREF, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 713); do {
} while (false); do { MOZ_CrashSequence(__null, 713); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
714 MOZ_RELEASE_ASSERT(CopyConstV(v3).match(MakeConstDescriber()) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v3).match(MakeConstDescriber()) == RESULT
(U64, ParamCRREF, ThisCRREF, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v3).match(MakeConstDescriber
()) == RESULT(U64, ParamCRREF, ThisCRREF, 3)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v3).match(MakeConstDescriber()) == RESULT(U64, ParamCRREF, ThisCRREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 715); do {
} while (false); do { MOZ_CrashSequence(__null, 715); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
715 RESULT(U64, ParamCRREF, ThisCRREF, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v3).match(MakeConstDescriber()) == RESULT
(U64, ParamCRREF, ThisCRREF, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v3).match(MakeConstDescriber
()) == RESULT(U64, ParamCRREF, ThisCRREF, 3)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v3).match(MakeConstDescriber()) == RESULT(U64, ParamCRREF, ThisCRREF, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 715); do {
} while (false); do { MOZ_CrashSequence(__null, 715); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
716}
717
718static void testMatchingLambda() {
719 printf("testMatchingLambda\n");
720 using V = Variant<uint8_t, uint32_t, uint64_t>;
721
722 // Note: Lambdas' call operators are const by default (unless the lambda is
723 // declared `mutable`).
724 // There is no need to test mutable lambdas, nor rvalue lambda, because there
725 // would be no way to distinguish how each lambda is actually invoked because
726 // there is only one choice of call operator in each overload set.
727 auto desc = [](auto&& a) {
728 if constexpr (std::is_same_v<decltype(a), uint8_t&>) {
729 return RESULT(U8, ParamLREF, NA, a);
730 } else if constexpr (std::is_same_v<decltype(a), const uint8_t&>) {
731 return RESULT(U8, ParamCLREF, NA, a);
732 } else if constexpr (std::is_same_v<decltype(a), uint8_t&&>) {
733 return RESULT(U8, ParamRREF, NA, a);
734 } else if constexpr (std::is_same_v<decltype(a), const uint8_t&&>) {
735 return RESULT(U8, ParamCRREF, NA, a);
736 } else if constexpr (std::is_same_v<decltype(a), uint32_t&>) {
737 return RESULT(U32, ParamLREF, NA, a);
738 } else if constexpr (std::is_same_v<decltype(a), const uint32_t&>) {
739 return RESULT(U32, ParamCLREF, NA, a);
740 } else if constexpr (std::is_same_v<decltype(a), uint32_t&&>) {
741 return RESULT(U32, ParamRREF, NA, a);
742 } else if constexpr (std::is_same_v<decltype(a), const uint32_t&&>) {
743 return RESULT(U32, ParamCRREF, NA, a);
744 } else if constexpr (std::is_same_v<decltype(a), uint64_t&>) {
745 return RESULT(U64, ParamLREF, NA, a);
746 } else if constexpr (std::is_same_v<decltype(a), const uint64_t&>) {
747 return RESULT(U64, ParamCLREF, NA, a);
748 } else if constexpr (std::is_same_v<decltype(a), uint64_t&&>) {
749 return RESULT(U64, ParamRREF, NA, a);
750 } else if constexpr (std::is_same_v<decltype(a), const uint64_t&&>) {
751 return RESULT(U64, ParamCRREF, NA, a);
752 } else {
753 // We don't expect any other type.
754 // Tech note: We can't just do `static_assert(false)` which would always
755 // fail during the initial parsing. So we depend on the templated
756 // parameter to delay computing `false` until actual instantiation.
757 static_assert(sizeof(a) == size_t(-1));
758 return RESULT(NA, NA, NA, 0);
759 }
760 };
761
762 V v1(uint8_t(1));
763 V v2(uint32_t(2));
764 V v3(uint64_t(3));
765
766 const V& constRef1 = v1;
767 const V& constRef2 = v2;
768 const V& constRef3 = v3;
769
770 // Create a temporary variant by returning a copy of one.
771 auto CopyV = [](const V& aV) { return aV; };
772
773 // Create a temporary variant by returning a const copy of one.
774 auto CopyConstV = [](const V& aV) -> const V { return aV; };
775
776 MOZ_RELEASE_ASSERT(v1.match(desc) == RESULT(U8, ParamLREF, NA, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.match(desc) == RESULT(U8, ParamLREF, NA, 1))>::
isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v1.match(desc) == RESULT(U8, ParamLREF, NA, 1)))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("v1.match(desc) == RESULT(U8, ParamLREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 776); do {
} while (false); do { MOZ_CrashSequence(__null, 776); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
777 MOZ_RELEASE_ASSERT(v2.match(desc) == RESULT(U32, ParamLREF, NA, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.match(desc) == RESULT(U32, ParamLREF, NA, 2))>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v2.match(desc) == RESULT(U32, ParamLREF, NA, 2)))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("v2.match(desc) == RESULT(U32, ParamLREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 777); do {
} while (false); do { MOZ_CrashSequence(__null, 777); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
778 MOZ_RELEASE_ASSERT(v3.match(desc) == RESULT(U64, ParamLREF, NA, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.match(desc) == RESULT(U64, ParamLREF, NA, 3))>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v3.match(desc) == RESULT(U64, ParamLREF, NA, 3)))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("v3.match(desc) == RESULT(U64, ParamLREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 778); do {
} while (false); do { MOZ_CrashSequence(__null, 778); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
779
780 MOZ_RELEASE_ASSERT(constRef1.match(desc) == RESULT(U8, ParamCLREF, NA, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef1.match(desc) == RESULT(U8, ParamCLREF, NA, 1
))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(constRef1.match(desc) == RESULT(U8, ParamCLREF, NA, 1
)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("constRef1.match(desc) == RESULT(U8, ParamCLREF, NA, 1)", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 780); do { } while (false); do { MOZ_CrashSequence(__null, 780
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
781 MOZ_RELEASE_ASSERT(constRef2.match(desc) == RESULT(U32, ParamCLREF, NA, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef2.match(desc) == RESULT(U32, ParamCLREF, NA,
2))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(constRef2.match(desc) == RESULT(U32, ParamCLREF, NA,
2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("constRef2.match(desc) == RESULT(U32, ParamCLREF, NA, 2)", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 781); do { } while (false); do { MOZ_CrashSequence(__null, 781
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
782 MOZ_RELEASE_ASSERT(constRef3.match(desc) == RESULT(U64, ParamCLREF, NA, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef3.match(desc) == RESULT(U64, ParamCLREF, NA,
3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(constRef3.match(desc) == RESULT(U64, ParamCLREF, NA,
3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("constRef3.match(desc) == RESULT(U64, ParamCLREF, NA, 3)", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 782); do { } while (false); do { MOZ_CrashSequence(__null, 782
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
783
784 MOZ_RELEASE_ASSERT(CopyV(v1).match(desc) == RESULT(U8, ParamRREF, NA, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v1).match(desc) == RESULT(U8, ParamRREF, NA, 1
))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyV(v1).match(desc) == RESULT(U8, ParamRREF, NA, 1
)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyV(v1).match(desc) == RESULT(U8, ParamRREF, NA, 1)", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 784); do { } while (false); do { MOZ_CrashSequence(__null, 784
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
785 MOZ_RELEASE_ASSERT(CopyV(v2).match(desc) == RESULT(U32, ParamRREF, NA, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v2).match(desc) == RESULT(U32, ParamRREF, NA, 2
))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyV(v2).match(desc) == RESULT(U32, ParamRREF, NA, 2
)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyV(v2).match(desc) == RESULT(U32, ParamRREF, NA, 2)", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 785); do { } while (false); do { MOZ_CrashSequence(__null, 785
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
786 MOZ_RELEASE_ASSERT(CopyV(v3).match(desc) == RESULT(U64, ParamRREF, NA, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v3).match(desc) == RESULT(U64, ParamRREF, NA, 3
))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyV(v3).match(desc) == RESULT(U64, ParamRREF, NA, 3
)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyV(v3).match(desc) == RESULT(U64, ParamRREF, NA, 3)", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 786); do { } while (false); do { MOZ_CrashSequence(__null, 786
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
787
788 MOZ_RELEASE_ASSERT(CopyConstV(v1).match(desc) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v1).match(desc) == RESULT(U8, ParamCRREF,
NA, 1))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyConstV(v1).match(desc) == RESULT(U8, ParamCRREF,
NA, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyConstV(v1).match(desc) == RESULT(U8, ParamCRREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 789); do {
} while (false); do { MOZ_CrashSequence(__null, 789); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
789 RESULT(U8, ParamCRREF, NA, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v1).match(desc) == RESULT(U8, ParamCRREF,
NA, 1))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyConstV(v1).match(desc) == RESULT(U8, ParamCRREF,
NA, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyConstV(v1).match(desc) == RESULT(U8, ParamCRREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 789); do {
} while (false); do { MOZ_CrashSequence(__null, 789); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
790 MOZ_RELEASE_ASSERT(CopyConstV(v2).match(desc) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v2).match(desc) == RESULT(U32, ParamCRREF
, NA, 2))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(CopyConstV(v2).match(desc) == RESULT
(U32, ParamCRREF, NA, 2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyConstV(v2).match(desc) == RESULT(U32, ParamCRREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 791); do {
} while (false); do { MOZ_CrashSequence(__null, 791); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
791 RESULT(U32, ParamCRREF, NA, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v2).match(desc) == RESULT(U32, ParamCRREF
, NA, 2))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(CopyConstV(v2).match(desc) == RESULT
(U32, ParamCRREF, NA, 2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyConstV(v2).match(desc) == RESULT(U32, ParamCRREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 791); do {
} while (false); do { MOZ_CrashSequence(__null, 791); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
792 MOZ_RELEASE_ASSERT(CopyConstV(v3).match(desc) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v3).match(desc) == RESULT(U64, ParamCRREF
, NA, 3))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(CopyConstV(v3).match(desc) == RESULT
(U64, ParamCRREF, NA, 3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyConstV(v3).match(desc) == RESULT(U64, ParamCRREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 793); do {
} while (false); do { MOZ_CrashSequence(__null, 793); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
793 RESULT(U64, ParamCRREF, NA, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v3).match(desc) == RESULT(U64, ParamCRREF
, NA, 3))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(CopyConstV(v3).match(desc) == RESULT
(U64, ParamCRREF, NA, 3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyConstV(v3).match(desc) == RESULT(U64, ParamCRREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 793); do {
} while (false); do { MOZ_CrashSequence(__null, 793); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
794}
795
796static void testMatchingLambdaWithIndex() {
797 printf("testMatchingLambdaWithIndex\n");
798 using V = Variant<uint8_t, uint32_t, uint64_t>;
799
800 // Note: Lambdas' call operators are const by default (unless the lambda is
801 // declared `mutable`), hence the use of "...Const" strings below.
802 // There is no need to test mutable lambdas, nor rvalue lambda, because there
803 // would be no way to distinguish how each lambda is actually invoked because
804 // there is only one choice of call operator in each overload set.
805 auto desc = [](auto aIndex, auto&& a) {
806 static_assert(
807 std::is_same_v<decltype(aIndex), uint_fast8_t>,
808 "Expected a uint_fast8_t index for a Variant with 3 alternatives");
809 if constexpr (std::is_same_v<decltype(a), uint8_t&>) {
810 MOZ_RELEASE_ASSERT(aIndex == 0)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aIndex == 0)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aIndex == 0))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("aIndex == 0", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 810); do { } while (false); do { MOZ_CrashSequence(__null, 810
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
811 return RESULT(U8, ParamLREF, NA, a);
812 } else if constexpr (std::is_same_v<decltype(a), const uint8_t&>) {
813 MOZ_RELEASE_ASSERT(aIndex == 0)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aIndex == 0)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aIndex == 0))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("aIndex == 0", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 813); do { } while (false); do { MOZ_CrashSequence(__null, 813
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
814 return RESULT(U8, ParamCLREF, NA, a);
815 } else if constexpr (std::is_same_v<decltype(a), uint8_t&&>) {
816 MOZ_RELEASE_ASSERT(aIndex == 0)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aIndex == 0)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aIndex == 0))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("aIndex == 0", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 816); do { } while (false); do { MOZ_CrashSequence(__null, 816
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
817 return RESULT(U8, ParamRREF, NA, a);
818 } else if constexpr (std::is_same_v<decltype(a), const uint8_t&&>) {
819 MOZ_RELEASE_ASSERT(aIndex == 0)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aIndex == 0)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aIndex == 0))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("aIndex == 0", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 819); do { } while (false); do { MOZ_CrashSequence(__null, 819
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
820 return RESULT(U8, ParamCRREF, NA, a);
821 } else if constexpr (std::is_same_v<decltype(a), uint32_t&>) {
822 MOZ_RELEASE_ASSERT(aIndex == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aIndex == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aIndex == 1))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("aIndex == 1", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 822); do { } while (false); do { MOZ_CrashSequence(__null, 822
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
823 return RESULT(U32, ParamLREF, NA, a);
824 } else if constexpr (std::is_same_v<decltype(a), const uint32_t&>) {
825 MOZ_RELEASE_ASSERT(aIndex == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aIndex == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aIndex == 1))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("aIndex == 1", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 825); do { } while (false); do { MOZ_CrashSequence(__null, 825
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
826 return RESULT(U32, ParamCLREF, NA, a);
827 } else if constexpr (std::is_same_v<decltype(a), uint32_t&&>) {
828 MOZ_RELEASE_ASSERT(aIndex == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aIndex == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aIndex == 1))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("aIndex == 1", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 828); do { } while (false); do { MOZ_CrashSequence(__null, 828
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
829 return RESULT(U32, ParamRREF, NA, a);
830 } else if constexpr (std::is_same_v<decltype(a), const uint32_t&&>) {
831 MOZ_RELEASE_ASSERT(aIndex == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aIndex == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aIndex == 1))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("aIndex == 1", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 831); do { } while (false); do { MOZ_CrashSequence(__null, 831
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
832 return RESULT(U32, ParamCRREF, NA, a);
833 } else if constexpr (std::is_same_v<decltype(a), uint64_t&>) {
834 MOZ_RELEASE_ASSERT(aIndex == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aIndex == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aIndex == 2))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("aIndex == 2", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 834); do { } while (false); do { MOZ_CrashSequence(__null, 834
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
835 return RESULT(U64, ParamLREF, NA, a);
836 } else if constexpr (std::is_same_v<decltype(a), const uint64_t&>) {
837 MOZ_RELEASE_ASSERT(aIndex == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aIndex == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aIndex == 2))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("aIndex == 2", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 837); do { } while (false); do { MOZ_CrashSequence(__null, 837
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
838 return RESULT(U64, ParamCLREF, NA, a);
839 } else if constexpr (std::is_same_v<decltype(a), uint64_t&&>) {
840 MOZ_RELEASE_ASSERT(aIndex == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aIndex == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aIndex == 2))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("aIndex == 2", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 840); do { } while (false); do { MOZ_CrashSequence(__null, 840
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
841 return RESULT(U64, ParamRREF, NA, a);
842 } else if constexpr (std::is_same_v<decltype(a), const uint64_t&&>) {
843 MOZ_RELEASE_ASSERT(aIndex == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aIndex == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aIndex == 2))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("aIndex == 2", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 843); do { } while (false); do { MOZ_CrashSequence(__null, 843
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
844 return RESULT(U64, ParamCRREF, NA, a);
845 } else {
846 // We don't expect any other type.
847 // Tech note: We can't just do `static_assert(false)` which would always
848 // fail during the initial parsing. So we depend on the templated
849 // parameter to delay computing `false` until actual instantiation.
850 static_assert(sizeof(a) == size_t(-1));
851 return RESULT(NA, NA, NA, 0);
852 }
853 };
854
855 V v1(uint8_t(1));
856 V v2(uint32_t(2));
857 V v3(uint64_t(3));
858
859 const V& constRef1 = v1;
860 const V& constRef2 = v2;
861 const V& constRef3 = v3;
862
863 // Create a temporary variant by returning a copy of one.
864 auto CopyV = [](const V& aV) { return aV; };
865
866 // Create a temporary variant by returning a const copy of one.
867 auto CopyConstV = [](const V& aV) -> const V { return aV; };
868
869 MOZ_RELEASE_ASSERT(v1.match(desc) == RESULT(U8, ParamLREF, NA, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.match(desc) == RESULT(U8, ParamLREF, NA, 1))>::
isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v1.match(desc) == RESULT(U8, ParamLREF, NA, 1)))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("v1.match(desc) == RESULT(U8, ParamLREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 869); do {
} while (false); do { MOZ_CrashSequence(__null, 869); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
870 MOZ_RELEASE_ASSERT(v2.match(desc) == RESULT(U32, ParamLREF, NA, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.match(desc) == RESULT(U32, ParamLREF, NA, 2))>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v2.match(desc) == RESULT(U32, ParamLREF, NA, 2)))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("v2.match(desc) == RESULT(U32, ParamLREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 870); do {
} while (false); do { MOZ_CrashSequence(__null, 870); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
871 MOZ_RELEASE_ASSERT(v3.match(desc) == RESULT(U64, ParamLREF, NA, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.match(desc) == RESULT(U64, ParamLREF, NA, 3))>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(v3.match(desc) == RESULT(U64, ParamLREF, NA, 3)))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("v3.match(desc) == RESULT(U64, ParamLREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 871); do {
} while (false); do { MOZ_CrashSequence(__null, 871); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
872
873 MOZ_RELEASE_ASSERT(constRef1.match(desc) == RESULT(U8, ParamCLREF, NA, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef1.match(desc) == RESULT(U8, ParamCLREF, NA, 1
))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(constRef1.match(desc) == RESULT(U8, ParamCLREF, NA, 1
)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("constRef1.match(desc) == RESULT(U8, ParamCLREF, NA, 1)", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 873); do { } while (false); do { MOZ_CrashSequence(__null, 873
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
874 MOZ_RELEASE_ASSERT(constRef2.match(desc) == RESULT(U32, ParamCLREF, NA, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef2.match(desc) == RESULT(U32, ParamCLREF, NA,
2))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(constRef2.match(desc) == RESULT(U32, ParamCLREF, NA,
2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("constRef2.match(desc) == RESULT(U32, ParamCLREF, NA, 2)", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 874); do { } while (false); do { MOZ_CrashSequence(__null, 874
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
875 MOZ_RELEASE_ASSERT(constRef3.match(desc) == RESULT(U64, ParamCLREF, NA, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef3.match(desc) == RESULT(U64, ParamCLREF, NA,
3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(constRef3.match(desc) == RESULT(U64, ParamCLREF, NA,
3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("constRef3.match(desc) == RESULT(U64, ParamCLREF, NA, 3)", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 875); do { } while (false); do { MOZ_CrashSequence(__null, 875
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
876
877 MOZ_RELEASE_ASSERT(CopyV(v1).match(desc) == RESULT(U8, ParamRREF, NA, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v1).match(desc) == RESULT(U8, ParamRREF, NA, 1
))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyV(v1).match(desc) == RESULT(U8, ParamRREF, NA, 1
)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyV(v1).match(desc) == RESULT(U8, ParamRREF, NA, 1)", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 877); do { } while (false); do { MOZ_CrashSequence(__null, 877
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
878 MOZ_RELEASE_ASSERT(CopyV(v2).match(desc) == RESULT(U32, ParamRREF, NA, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v2).match(desc) == RESULT(U32, ParamRREF, NA, 2
))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyV(v2).match(desc) == RESULT(U32, ParamRREF, NA, 2
)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyV(v2).match(desc) == RESULT(U32, ParamRREF, NA, 2)", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 878); do { } while (false); do { MOZ_CrashSequence(__null, 878
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
879 MOZ_RELEASE_ASSERT(CopyV(v3).match(desc) == RESULT(U64, ParamRREF, NA, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v3).match(desc) == RESULT(U64, ParamRREF, NA, 3
))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyV(v3).match(desc) == RESULT(U64, ParamRREF, NA, 3
)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyV(v3).match(desc) == RESULT(U64, ParamRREF, NA, 3)", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 879); do { } while (false); do { MOZ_CrashSequence(__null, 879
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
880
881 MOZ_RELEASE_ASSERT(CopyConstV(v1).match(desc) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v1).match(desc) == RESULT(U8, ParamCRREF,
NA, 1))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyConstV(v1).match(desc) == RESULT(U8, ParamCRREF,
NA, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyConstV(v1).match(desc) == RESULT(U8, ParamCRREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 882); do {
} while (false); do { MOZ_CrashSequence(__null, 882); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
882 RESULT(U8, ParamCRREF, NA, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v1).match(desc) == RESULT(U8, ParamCRREF,
NA, 1))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(CopyConstV(v1).match(desc) == RESULT(U8, ParamCRREF,
NA, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyConstV(v1).match(desc) == RESULT(U8, ParamCRREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 882); do {
} while (false); do { MOZ_CrashSequence(__null, 882); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
883 MOZ_RELEASE_ASSERT(CopyConstV(v2).match(desc) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v2).match(desc) == RESULT(U32, ParamCRREF
, NA, 2))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(CopyConstV(v2).match(desc) == RESULT
(U32, ParamCRREF, NA, 2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyConstV(v2).match(desc) == RESULT(U32, ParamCRREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 884); do {
} while (false); do { MOZ_CrashSequence(__null, 884); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
884 RESULT(U32, ParamCRREF, NA, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v2).match(desc) == RESULT(U32, ParamCRREF
, NA, 2))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(CopyConstV(v2).match(desc) == RESULT
(U32, ParamCRREF, NA, 2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyConstV(v2).match(desc) == RESULT(U32, ParamCRREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 884); do {
} while (false); do { MOZ_CrashSequence(__null, 884); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
885 MOZ_RELEASE_ASSERT(CopyConstV(v3).match(desc) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v3).match(desc) == RESULT(U64, ParamCRREF
, NA, 3))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(CopyConstV(v3).match(desc) == RESULT
(U64, ParamCRREF, NA, 3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyConstV(v3).match(desc) == RESULT(U64, ParamCRREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 886); do {
} while (false); do { MOZ_CrashSequence(__null, 886); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
886 RESULT(U64, ParamCRREF, NA, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v3).match(desc) == RESULT(U64, ParamCRREF
, NA, 3))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(CopyConstV(v3).match(desc) == RESULT
(U64, ParamCRREF, NA, 3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("CopyConstV(v3).match(desc) == RESULT(U64, ParamCRREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 886); do {
} while (false); do { MOZ_CrashSequence(__null, 886); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
887}
888
889static void testMatchingLambdas() {
890 printf("testMatchingLambdas\n");
891 using V = Variant<uint8_t, uint32_t, uint64_t>;
892
893 auto desc8 = [](auto&& a) {
894 if constexpr (std::is_same_v<decltype(a), uint8_t&>) {
895 return RESULT(U8, ParamLREF, NA, a);
896 } else if constexpr (std::is_same_v<decltype(a), const uint8_t&>) {
897 return RESULT(U8, ParamCLREF, NA, a);
898 } else if constexpr (std::is_same_v<decltype(a), uint8_t&&>) {
899 return RESULT(U8, ParamRREF, NA, a);
900 } else if constexpr (std::is_same_v<decltype(a), const uint8_t&&>) {
901 return RESULT(U8, ParamCRREF, NA, a);
902 } else {
903 // We don't expect any other type.
904 // Tech note: We can't just do `static_assert(false)` which would always
905 // fail during the initial parsing. So we depend on the templated
906 // parameter to delay computing `false` until actual instantiation.
907 static_assert(sizeof(a) == size_t(-1));
908 return RESULT(NA, NA, NA, 0);
909 }
910 };
911 auto desc32 = [](auto&& a) {
912 if constexpr (std::is_same_v<decltype(a), uint32_t&>) {
913 return RESULT(U32, ParamLREF, NA, a);
914 } else if constexpr (std::is_same_v<decltype(a), const uint32_t&>) {
915 return RESULT(U32, ParamCLREF, NA, a);
916 } else if constexpr (std::is_same_v<decltype(a), uint32_t&&>) {
917 return RESULT(U32, ParamRREF, NA, a);
918 } else if constexpr (std::is_same_v<decltype(a), const uint32_t&&>) {
919 return RESULT(U32, ParamCRREF, NA, a);
920 } else {
921 // We don't expect any other type.
922 // Tech note: We can't just do `static_assert(false)` which would always
923 // fail during the initial parsing. So we depend on the templated
924 // parameter to delay computing `false` until actual instantiation.
925 static_assert(sizeof(a) == size_t(-1));
926 return RESULT(NA, NA, NA, 0);
927 }
928 };
929 auto desc64 = [](auto&& a) {
930 if constexpr (std::is_same_v<decltype(a), uint64_t&>) {
931 return RESULT(U64, ParamLREF, NA, a);
932 } else if constexpr (std::is_same_v<decltype(a), const uint64_t&>) {
933 return RESULT(U64, ParamCLREF, NA, a);
934 } else if constexpr (std::is_same_v<decltype(a), uint64_t&&>) {
935 return RESULT(U64, ParamRREF, NA, a);
936 } else if constexpr (std::is_same_v<decltype(a), const uint64_t&&>) {
937 return RESULT(U64, ParamCRREF, NA, a);
938 } else {
939 // We don't expect any other type.
940 // Tech note: We can't just do `static_assert(false)` which would always
941 // fail during the initial parsing. So we depend on the templated
942 // parameter to delay computing `false` until actual instantiation.
943 static_assert(sizeof(a) == size_t(-1));
944 return RESULT(NA, NA, NA, 0);
945 }
946 };
947
948 V v1(uint8_t(1));
949 V v2(uint32_t(2));
950 V v3(uint64_t(3));
951
952 const V& constRef1 = v1;
953 const V& constRef2 = v2;
954 const V& constRef3 = v3;
955
956 // Create a temporary variant by returning a copy of one.
957 auto CopyV = [](const V& aV) { return aV; };
958
959 // Create a temporary variant by returning a const copy of one.
960 auto CopyConstV = [](const V& aV) -> const V { return aV; };
961
962 MOZ_RELEASE_ASSERT(v1.match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.match(desc8, desc32, desc64) == RESULT(U8, ParamLREF
, NA, 1))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(v1.match(desc8, desc32, desc64) == RESULT
(U8, ParamLREF, NA, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v1.match(desc8, desc32, desc64) == RESULT(U8, ParamLREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 963); do {
} while (false); do { MOZ_CrashSequence(__null, 963); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
963 RESULT(U8, ParamLREF, NA, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.match(desc8, desc32, desc64) == RESULT(U8, ParamLREF
, NA, 1))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(v1.match(desc8, desc32, desc64) == RESULT
(U8, ParamLREF, NA, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v1.match(desc8, desc32, desc64) == RESULT(U8, ParamLREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 963); do {
} while (false); do { MOZ_CrashSequence(__null, 963); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
964 MOZ_RELEASE_ASSERT(v2.match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.match(desc8, desc32, desc64) == RESULT(U32, ParamLREF
, NA, 2))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(v2.match(desc8, desc32, desc64) == RESULT
(U32, ParamLREF, NA, 2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v2.match(desc8, desc32, desc64) == RESULT(U32, ParamLREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 965); do {
} while (false); do { MOZ_CrashSequence(__null, 965); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
965 RESULT(U32, ParamLREF, NA, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.match(desc8, desc32, desc64) == RESULT(U32, ParamLREF
, NA, 2))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(v2.match(desc8, desc32, desc64) == RESULT
(U32, ParamLREF, NA, 2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v2.match(desc8, desc32, desc64) == RESULT(U32, ParamLREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 965); do {
} while (false); do { MOZ_CrashSequence(__null, 965); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
966 MOZ_RELEASE_ASSERT(v3.match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.match(desc8, desc32, desc64) == RESULT(U64, ParamLREF
, NA, 3))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(v3.match(desc8, desc32, desc64) == RESULT
(U64, ParamLREF, NA, 3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v3.match(desc8, desc32, desc64) == RESULT(U64, ParamLREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 967); do {
} while (false); do { MOZ_CrashSequence(__null, 967); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
967 RESULT(U64, ParamLREF, NA, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.match(desc8, desc32, desc64) == RESULT(U64, ParamLREF
, NA, 3))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(v3.match(desc8, desc32, desc64) == RESULT
(U64, ParamLREF, NA, 3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v3.match(desc8, desc32, desc64) == RESULT(U64, ParamLREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 967); do {
} while (false); do { MOZ_CrashSequence(__null, 967); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
968
969 MOZ_RELEASE_ASSERT(constRef1.match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef1.match(desc8, desc32, desc64) == RESULT(U8,
ParamCLREF, NA, 1))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(constRef1.match(desc8, desc32
, desc64) == RESULT(U8, ParamCLREF, NA, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("constRef1.match(desc8, desc32, desc64) == RESULT(U8, ParamCLREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 970); do {
} while (false); do { MOZ_CrashSequence(__null, 970); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
970 RESULT(U8, ParamCLREF, NA, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef1.match(desc8, desc32, desc64) == RESULT(U8,
ParamCLREF, NA, 1))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(constRef1.match(desc8, desc32
, desc64) == RESULT(U8, ParamCLREF, NA, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("constRef1.match(desc8, desc32, desc64) == RESULT(U8, ParamCLREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 970); do {
} while (false); do { MOZ_CrashSequence(__null, 970); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
971 MOZ_RELEASE_ASSERT(constRef2.match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef2.match(desc8, desc32, desc64) == RESULT(U32
, ParamCLREF, NA, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(constRef2.match(desc8, desc32
, desc64) == RESULT(U32, ParamCLREF, NA, 2)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("constRef2.match(desc8, desc32, desc64) == RESULT(U32, ParamCLREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 972); do {
} while (false); do { MOZ_CrashSequence(__null, 972); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
972 RESULT(U32, ParamCLREF, NA, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef2.match(desc8, desc32, desc64) == RESULT(U32
, ParamCLREF, NA, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(constRef2.match(desc8, desc32
, desc64) == RESULT(U32, ParamCLREF, NA, 2)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("constRef2.match(desc8, desc32, desc64) == RESULT(U32, ParamCLREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 972); do {
} while (false); do { MOZ_CrashSequence(__null, 972); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
973 MOZ_RELEASE_ASSERT(constRef3.match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef3.match(desc8, desc32, desc64) == RESULT(U64
, ParamCLREF, NA, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(constRef3.match(desc8, desc32
, desc64) == RESULT(U64, ParamCLREF, NA, 3)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("constRef3.match(desc8, desc32, desc64) == RESULT(U64, ParamCLREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 974); do {
} while (false); do { MOZ_CrashSequence(__null, 974); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
974 RESULT(U64, ParamCLREF, NA, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef3.match(desc8, desc32, desc64) == RESULT(U64
, ParamCLREF, NA, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(constRef3.match(desc8, desc32
, desc64) == RESULT(U64, ParamCLREF, NA, 3)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("constRef3.match(desc8, desc32, desc64) == RESULT(U64, ParamCLREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 974); do {
} while (false); do { MOZ_CrashSequence(__null, 974); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
975
976 MOZ_RELEASE_ASSERT(CopyV(v1).match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v1).match(desc8, desc32, desc64) == RESULT(U8,
ParamRREF, NA, 1))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyV(v1).match(desc8, desc32
, desc64) == RESULT(U8, ParamRREF, NA, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v1).match(desc8, desc32, desc64) == RESULT(U8, ParamRREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 977); do {
} while (false); do { MOZ_CrashSequence(__null, 977); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
977 RESULT(U8, ParamRREF, NA, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v1).match(desc8, desc32, desc64) == RESULT(U8,
ParamRREF, NA, 1))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyV(v1).match(desc8, desc32
, desc64) == RESULT(U8, ParamRREF, NA, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v1).match(desc8, desc32, desc64) == RESULT(U8, ParamRREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 977); do {
} while (false); do { MOZ_CrashSequence(__null, 977); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
978 MOZ_RELEASE_ASSERT(CopyV(v2).match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v2).match(desc8, desc32, desc64) == RESULT(U32
, ParamRREF, NA, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyV(v2).match(desc8, desc32
, desc64) == RESULT(U32, ParamRREF, NA, 2)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v2).match(desc8, desc32, desc64) == RESULT(U32, ParamRREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 979); do {
} while (false); do { MOZ_CrashSequence(__null, 979); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
979 RESULT(U32, ParamRREF, NA, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v2).match(desc8, desc32, desc64) == RESULT(U32
, ParamRREF, NA, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyV(v2).match(desc8, desc32
, desc64) == RESULT(U32, ParamRREF, NA, 2)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v2).match(desc8, desc32, desc64) == RESULT(U32, ParamRREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 979); do {
} while (false); do { MOZ_CrashSequence(__null, 979); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
980 MOZ_RELEASE_ASSERT(CopyV(v3).match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v3).match(desc8, desc32, desc64) == RESULT(U64
, ParamRREF, NA, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyV(v3).match(desc8, desc32
, desc64) == RESULT(U64, ParamRREF, NA, 3)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v3).match(desc8, desc32, desc64) == RESULT(U64, ParamRREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 981); do {
} while (false); do { MOZ_CrashSequence(__null, 981); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
981 RESULT(U64, ParamRREF, NA, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v3).match(desc8, desc32, desc64) == RESULT(U64
, ParamRREF, NA, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyV(v3).match(desc8, desc32
, desc64) == RESULT(U64, ParamRREF, NA, 3)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v3).match(desc8, desc32, desc64) == RESULT(U64, ParamRREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 981); do {
} while (false); do { MOZ_CrashSequence(__null, 981); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
982
983 MOZ_RELEASE_ASSERT(CopyConstV(v1).match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v1).match(desc8, desc32, desc64) == RESULT
(U8, ParamCRREF, NA, 1))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v1).match(desc8, desc32
, desc64) == RESULT(U8, ParamCRREF, NA, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyConstV(v1).match(desc8, desc32, desc64) == RESULT(U8, ParamCRREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 984); do {
} while (false); do { MOZ_CrashSequence(__null, 984); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
984 RESULT(U8, ParamCRREF, NA, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v1).match(desc8, desc32, desc64) == RESULT
(U8, ParamCRREF, NA, 1))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v1).match(desc8, desc32
, desc64) == RESULT(U8, ParamCRREF, NA, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyConstV(v1).match(desc8, desc32, desc64) == RESULT(U8, ParamCRREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 984); do {
} while (false); do { MOZ_CrashSequence(__null, 984); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
985 MOZ_RELEASE_ASSERT(CopyConstV(v2).match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v2).match(desc8, desc32, desc64) == RESULT
(U32, ParamCRREF, NA, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v2).match(desc8, desc32
, desc64) == RESULT(U32, ParamCRREF, NA, 2)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v2).match(desc8, desc32, desc64) == RESULT(U32, ParamCRREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 986); do {
} while (false); do { MOZ_CrashSequence(__null, 986); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
986 RESULT(U32, ParamCRREF, NA, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v2).match(desc8, desc32, desc64) == RESULT
(U32, ParamCRREF, NA, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v2).match(desc8, desc32
, desc64) == RESULT(U32, ParamCRREF, NA, 2)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v2).match(desc8, desc32, desc64) == RESULT(U32, ParamCRREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 986); do {
} while (false); do { MOZ_CrashSequence(__null, 986); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
987 MOZ_RELEASE_ASSERT(CopyConstV(v3).match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v3).match(desc8, desc32, desc64) == RESULT
(U64, ParamCRREF, NA, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v3).match(desc8, desc32
, desc64) == RESULT(U64, ParamCRREF, NA, 3)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v3).match(desc8, desc32, desc64) == RESULT(U64, ParamCRREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 988); do {
} while (false); do { MOZ_CrashSequence(__null, 988); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
988 RESULT(U64, ParamCRREF, NA, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v3).match(desc8, desc32, desc64) == RESULT
(U64, ParamCRREF, NA, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v3).match(desc8, desc32
, desc64) == RESULT(U64, ParamCRREF, NA, 3)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v3).match(desc8, desc32, desc64) == RESULT(U64, ParamCRREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 988); do {
} while (false); do { MOZ_CrashSequence(__null, 988); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
989}
990
991static void testMatchingLambdasWithIndex() {
992 printf("testMatchingLambdasWithIndex\n");
993 using V = Variant<uint8_t, uint32_t, uint64_t>;
994
995 auto desc8 = [](size_t aIndex, auto&& a) {
996 MOZ_RELEASE_ASSERT(aIndex == 0)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aIndex == 0)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aIndex == 0))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("aIndex == 0", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 996); do { } while (false); do { MOZ_CrashSequence(__null, 996
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
997 if constexpr (std::is_same_v<decltype(a), uint8_t&>) {
998 return RESULT(U8, ParamLREF, NA, a);
999 } else if constexpr (std::is_same_v<decltype(a), const uint8_t&>) {
1000 return RESULT(U8, ParamCLREF, NA, a);
1001 } else if constexpr (std::is_same_v<decltype(a), uint8_t&&>) {
1002 return RESULT(U8, ParamRREF, NA, a);
1003 } else if constexpr (std::is_same_v<decltype(a), const uint8_t&&>) {
1004 return RESULT(U8, ParamCRREF, NA, a);
1005 } else {
1006 // We don't expect any other type.
1007 // Tech note: We can't just do `static_assert(false)` which would always
1008 // fail during the initial parsing. So we depend on the templated
1009 // parameter to delay computing `false` until actual instantiation.
1010 static_assert(sizeof(a) == size_t(-1));
1011 return RESULT(NA, NA, NA, 0);
1012 }
1013 };
1014 auto desc32 = [](size_t aIndex, auto&& a) {
1015 MOZ_RELEASE_ASSERT(aIndex == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aIndex == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aIndex == 1))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("aIndex == 1", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 1015); do { } while (false); do { MOZ_CrashSequence(__null,
1015); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1016 if constexpr (std::is_same_v<decltype(a), uint32_t&>) {
1017 return RESULT(U32, ParamLREF, NA, a);
1018 } else if constexpr (std::is_same_v<decltype(a), const uint32_t&>) {
1019 return RESULT(U32, ParamCLREF, NA, a);
1020 } else if constexpr (std::is_same_v<decltype(a), uint32_t&&>) {
1021 return RESULT(U32, ParamRREF, NA, a);
1022 } else if constexpr (std::is_same_v<decltype(a), const uint32_t&&>) {
1023 return RESULT(U32, ParamCRREF, NA, a);
1024 } else {
1025 // We don't expect any other type.
1026 // Tech note: We can't just do `static_assert(false)` which would always
1027 // fail during the initial parsing. So we depend on the templated
1028 // parameter to delay computing `false` until actual instantiation.
1029 static_assert(sizeof(a) == size_t(-1));
1030 return RESULT(NA, NA, NA, 0);
1031 }
1032 };
1033 auto desc64 = [](size_t aIndex, auto&& a) {
1034 MOZ_RELEASE_ASSERT(aIndex == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aIndex == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aIndex == 2))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("aIndex == 2", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 1034); do { } while (false); do { MOZ_CrashSequence(__null,
1034); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1035 if constexpr (std::is_same_v<decltype(a), uint64_t&>) {
1036 return RESULT(U64, ParamLREF, NA, a);
1037 } else if constexpr (std::is_same_v<decltype(a), const uint64_t&>) {
1038 return RESULT(U64, ParamCLREF, NA, a);
1039 } else if constexpr (std::is_same_v<decltype(a), uint64_t&&>) {
1040 return RESULT(U64, ParamRREF, NA, a);
1041 } else if constexpr (std::is_same_v<decltype(a), const uint64_t&&>) {
1042 return RESULT(U64, ParamCRREF, NA, a);
1043 } else {
1044 // We don't expect any other type.
1045 // Tech note: We can't just do `static_assert(false)` which would always
1046 // fail during the initial parsing. So we depend on the templated
1047 // parameter to delay computing `false` until actual instantiation.
1048 static_assert(sizeof(a) == size_t(-1));
1049 return RESULT(NA, NA, NA, 0);
1050 }
1051 };
1052
1053 V v1(uint8_t(1));
1054 V v2(uint32_t(2));
1055 V v3(uint64_t(3));
1056
1057 const V& constRef1 = v1;
1058 const V& constRef2 = v2;
1059 const V& constRef3 = v3;
1060
1061 // Create a temporary variant by returning a copy of one.
1062 auto CopyV = [](const V& aV) { return aV; };
1063
1064 // Create a temporary variant by returning a const copy of one.
1065 auto CopyConstV = [](const V& aV) -> const V { return aV; };
1066
1067 MOZ_RELEASE_ASSERT(v1.match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.match(desc8, desc32, desc64) == RESULT(U8, ParamLREF
, NA, 1))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(v1.match(desc8, desc32, desc64) == RESULT
(U8, ParamLREF, NA, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v1.match(desc8, desc32, desc64) == RESULT(U8, ParamLREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1068); do
{ } while (false); do { MOZ_CrashSequence(__null, 1068); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
1068 RESULT(U8, ParamLREF, NA, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v1.match(desc8, desc32, desc64) == RESULT(U8, ParamLREF
, NA, 1))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(v1.match(desc8, desc32, desc64) == RESULT
(U8, ParamLREF, NA, 1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v1.match(desc8, desc32, desc64) == RESULT(U8, ParamLREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1068); do
{ } while (false); do { MOZ_CrashSequence(__null, 1068); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1069 MOZ_RELEASE_ASSERT(v2.match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.match(desc8, desc32, desc64) == RESULT(U32, ParamLREF
, NA, 2))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(v2.match(desc8, desc32, desc64) == RESULT
(U32, ParamLREF, NA, 2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v2.match(desc8, desc32, desc64) == RESULT(U32, ParamLREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1070); do
{ } while (false); do { MOZ_CrashSequence(__null, 1070); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
1070 RESULT(U32, ParamLREF, NA, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v2.match(desc8, desc32, desc64) == RESULT(U32, ParamLREF
, NA, 2))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(v2.match(desc8, desc32, desc64) == RESULT
(U32, ParamLREF, NA, 2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v2.match(desc8, desc32, desc64) == RESULT(U32, ParamLREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1070); do
{ } while (false); do { MOZ_CrashSequence(__null, 1070); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1071 MOZ_RELEASE_ASSERT(v3.match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.match(desc8, desc32, desc64) == RESULT(U64, ParamLREF
, NA, 3))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(v3.match(desc8, desc32, desc64) == RESULT
(U64, ParamLREF, NA, 3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v3.match(desc8, desc32, desc64) == RESULT(U64, ParamLREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1072); do
{ } while (false); do { MOZ_CrashSequence(__null, 1072); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
1072 RESULT(U64, ParamLREF, NA, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v3.match(desc8, desc32, desc64) == RESULT(U64, ParamLREF
, NA, 3))>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(v3.match(desc8, desc32, desc64) == RESULT
(U64, ParamLREF, NA, 3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("v3.match(desc8, desc32, desc64) == RESULT(U64, ParamLREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1072); do
{ } while (false); do { MOZ_CrashSequence(__null, 1072); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1073
1074 MOZ_RELEASE_ASSERT(constRef1.match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef1.match(desc8, desc32, desc64) == RESULT(U8,
ParamCLREF, NA, 1))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(constRef1.match(desc8, desc32
, desc64) == RESULT(U8, ParamCLREF, NA, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("constRef1.match(desc8, desc32, desc64) == RESULT(U8, ParamCLREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1075); do
{ } while (false); do { MOZ_CrashSequence(__null, 1075); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
1075 RESULT(U8, ParamCLREF, NA, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef1.match(desc8, desc32, desc64) == RESULT(U8,
ParamCLREF, NA, 1))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(constRef1.match(desc8, desc32
, desc64) == RESULT(U8, ParamCLREF, NA, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("constRef1.match(desc8, desc32, desc64) == RESULT(U8, ParamCLREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1075); do
{ } while (false); do { MOZ_CrashSequence(__null, 1075); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1076 MOZ_RELEASE_ASSERT(constRef2.match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef2.match(desc8, desc32, desc64) == RESULT(U32
, ParamCLREF, NA, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(constRef2.match(desc8, desc32
, desc64) == RESULT(U32, ParamCLREF, NA, 2)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("constRef2.match(desc8, desc32, desc64) == RESULT(U32, ParamCLREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1077); do
{ } while (false); do { MOZ_CrashSequence(__null, 1077); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
1077 RESULT(U32, ParamCLREF, NA, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef2.match(desc8, desc32, desc64) == RESULT(U32
, ParamCLREF, NA, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(constRef2.match(desc8, desc32
, desc64) == RESULT(U32, ParamCLREF, NA, 2)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("constRef2.match(desc8, desc32, desc64) == RESULT(U32, ParamCLREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1077); do
{ } while (false); do { MOZ_CrashSequence(__null, 1077); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1078 MOZ_RELEASE_ASSERT(constRef3.match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef3.match(desc8, desc32, desc64) == RESULT(U64
, ParamCLREF, NA, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(constRef3.match(desc8, desc32
, desc64) == RESULT(U64, ParamCLREF, NA, 3)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("constRef3.match(desc8, desc32, desc64) == RESULT(U64, ParamCLREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1079); do
{ } while (false); do { MOZ_CrashSequence(__null, 1079); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
1079 RESULT(U64, ParamCLREF, NA, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(constRef3.match(desc8, desc32, desc64) == RESULT(U64
, ParamCLREF, NA, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(constRef3.match(desc8, desc32
, desc64) == RESULT(U64, ParamCLREF, NA, 3)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("constRef3.match(desc8, desc32, desc64) == RESULT(U64, ParamCLREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1079); do
{ } while (false); do { MOZ_CrashSequence(__null, 1079); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1080
1081 MOZ_RELEASE_ASSERT(CopyV(v1).match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v1).match(desc8, desc32, desc64) == RESULT(U8,
ParamRREF, NA, 1))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyV(v1).match(desc8, desc32
, desc64) == RESULT(U8, ParamRREF, NA, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v1).match(desc8, desc32, desc64) == RESULT(U8, ParamRREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1082); do
{ } while (false); do { MOZ_CrashSequence(__null, 1082); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
1082 RESULT(U8, ParamRREF, NA, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v1).match(desc8, desc32, desc64) == RESULT(U8,
ParamRREF, NA, 1))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyV(v1).match(desc8, desc32
, desc64) == RESULT(U8, ParamRREF, NA, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v1).match(desc8, desc32, desc64) == RESULT(U8, ParamRREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1082); do
{ } while (false); do { MOZ_CrashSequence(__null, 1082); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1083 MOZ_RELEASE_ASSERT(CopyV(v2).match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v2).match(desc8, desc32, desc64) == RESULT(U32
, ParamRREF, NA, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyV(v2).match(desc8, desc32
, desc64) == RESULT(U32, ParamRREF, NA, 2)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v2).match(desc8, desc32, desc64) == RESULT(U32, ParamRREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1084); do
{ } while (false); do { MOZ_CrashSequence(__null, 1084); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
1084 RESULT(U32, ParamRREF, NA, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v2).match(desc8, desc32, desc64) == RESULT(U32
, ParamRREF, NA, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyV(v2).match(desc8, desc32
, desc64) == RESULT(U32, ParamRREF, NA, 2)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v2).match(desc8, desc32, desc64) == RESULT(U32, ParamRREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1084); do
{ } while (false); do { MOZ_CrashSequence(__null, 1084); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1085 MOZ_RELEASE_ASSERT(CopyV(v3).match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v3).match(desc8, desc32, desc64) == RESULT(U64
, ParamRREF, NA, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyV(v3).match(desc8, desc32
, desc64) == RESULT(U64, ParamRREF, NA, 3)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v3).match(desc8, desc32, desc64) == RESULT(U64, ParamRREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1086); do
{ } while (false); do { MOZ_CrashSequence(__null, 1086); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
1086 RESULT(U64, ParamRREF, NA, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyV(v3).match(desc8, desc32, desc64) == RESULT(U64
, ParamRREF, NA, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyV(v3).match(desc8, desc32
, desc64) == RESULT(U64, ParamRREF, NA, 3)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyV(v3).match(desc8, desc32, desc64) == RESULT(U64, ParamRREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1086); do
{ } while (false); do { MOZ_CrashSequence(__null, 1086); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1087
1088 MOZ_RELEASE_ASSERT(CopyConstV(v1).match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v1).match(desc8, desc32, desc64) == RESULT
(U8, ParamCRREF, NA, 1))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v1).match(desc8, desc32
, desc64) == RESULT(U8, ParamCRREF, NA, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyConstV(v1).match(desc8, desc32, desc64) == RESULT(U8, ParamCRREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1089); do
{ } while (false); do { MOZ_CrashSequence(__null, 1089); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
1089 RESULT(U8, ParamCRREF, NA, 1))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v1).match(desc8, desc32, desc64) == RESULT
(U8, ParamCRREF, NA, 1))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v1).match(desc8, desc32
, desc64) == RESULT(U8, ParamCRREF, NA, 1)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("CopyConstV(v1).match(desc8, desc32, desc64) == RESULT(U8, ParamCRREF, NA, 1)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1089); do
{ } while (false); do { MOZ_CrashSequence(__null, 1089); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1090 MOZ_RELEASE_ASSERT(CopyConstV(v2).match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v2).match(desc8, desc32, desc64) == RESULT
(U32, ParamCRREF, NA, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v2).match(desc8, desc32
, desc64) == RESULT(U32, ParamCRREF, NA, 2)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v2).match(desc8, desc32, desc64) == RESULT(U32, ParamCRREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1091); do
{ } while (false); do { MOZ_CrashSequence(__null, 1091); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
1091 RESULT(U32, ParamCRREF, NA, 2))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v2).match(desc8, desc32, desc64) == RESULT
(U32, ParamCRREF, NA, 2))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v2).match(desc8, desc32
, desc64) == RESULT(U32, ParamCRREF, NA, 2)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v2).match(desc8, desc32, desc64) == RESULT(U32, ParamCRREF, NA, 2)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1091); do
{ } while (false); do { MOZ_CrashSequence(__null, 1091); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1092 MOZ_RELEASE_ASSERT(CopyConstV(v3).match(desc8, desc32, desc64) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v3).match(desc8, desc32, desc64) == RESULT
(U64, ParamCRREF, NA, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v3).match(desc8, desc32
, desc64) == RESULT(U64, ParamCRREF, NA, 3)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v3).match(desc8, desc32, desc64) == RESULT(U64, ParamCRREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1093); do
{ } while (false); do { MOZ_CrashSequence(__null, 1093); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
1093 RESULT(U64, ParamCRREF, NA, 3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(CopyConstV(v3).match(desc8, desc32, desc64) == RESULT
(U64, ParamCRREF, NA, 3))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(CopyConstV(v3).match(desc8, desc32
, desc64) == RESULT(U64, ParamCRREF, NA, 3)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("CopyConstV(v3).match(desc8, desc32, desc64) == RESULT(U64, ParamCRREF, NA, 3)"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1093); do
{ } while (false); do { MOZ_CrashSequence(__null, 1093); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1094}
1095
1096#undef RESULT
1097
1098static void testAddTagToHash() {
1099 printf("testAddToHash\n");
1100 using V = Variant<uint8_t, uint16_t, uint32_t, uint64_t>;
1101
1102 // We don't know what our hash function is, and these are certainly not all
1103 // true under all hash functions. But they are probably true under almost any
1104 // decent hash function, and our aim is simply to establish that the tag
1105 // *does* influence the hash value.
1106 {
1107 mozilla::HashNumber h8 = V(uint8_t(1)).addTagToHash(0);
1108 mozilla::HashNumber h16 = V(uint16_t(1)).addTagToHash(0);
1109 mozilla::HashNumber h32 = V(uint32_t(1)).addTagToHash(0);
1110 mozilla::HashNumber h64 = V(uint64_t(1)).addTagToHash(0);
1111
1112 MOZ_RELEASE_ASSERT(h8 != h16 && h8 != h32 && h8 != h64)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(h8 != h16 && h8 != h32 && h8 != h64)
>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(h8 != h16 && h8 != h32 && h8 != h64)
)), 0))) { do { } while (false); MOZ_ReportAssertionFailure("h8 != h16 && h8 != h32 && h8 != h64"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1112); do
{ } while (false); do { MOZ_CrashSequence(__null, 1112); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1113 MOZ_RELEASE_ASSERT(h16 != h32 && h16 != h64)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(h16 != h32 && h16 != h64)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(h16 != h32 && h16 !=
h64))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("h16 != h32 && h16 != h64", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 1113); do { } while (false); do { MOZ_CrashSequence(__null,
1113); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1114 MOZ_RELEASE_ASSERT(h32 != h64)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(h32 != h64)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(h32 != h64))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("h32 != h64", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 1114); do { } while (false); do { MOZ_CrashSequence(__null,
1114); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1115 }
1116
1117 {
1118 mozilla::HashNumber h8 = V(uint8_t(1)).addTagToHash(0x124356);
1119 mozilla::HashNumber h16 = V(uint16_t(1)).addTagToHash(0x124356);
1120 mozilla::HashNumber h32 = V(uint32_t(1)).addTagToHash(0x124356);
1121 mozilla::HashNumber h64 = V(uint64_t(1)).addTagToHash(0x124356);
1122
1123 MOZ_RELEASE_ASSERT(h8 != h16 && h8 != h32 && h8 != h64)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(h8 != h16 && h8 != h32 && h8 != h64)
>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(h8 != h16 && h8 != h32 && h8 != h64)
)), 0))) { do { } while (false); MOZ_ReportAssertionFailure("h8 != h16 && h8 != h32 && h8 != h64"
, "/root/firefox-clang/mfbt/tests/TestVariant.cpp", 1123); do
{ } while (false); do { MOZ_CrashSequence(__null, 1123); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1124 MOZ_RELEASE_ASSERT(h16 != h32 && h16 != h64)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(h16 != h32 && h16 != h64)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(h16 != h32 && h16 !=
h64))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("h16 != h32 && h16 != h64", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 1124); do { } while (false); do { MOZ_CrashSequence(__null,
1124); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1125 MOZ_RELEASE_ASSERT(h32 != h64)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(h32 != h64)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(h32 != h64))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("h32 != h64", "/root/firefox-clang/mfbt/tests/TestVariant.cpp"
, 1125); do { } while (false); do { MOZ_CrashSequence(__null,
1125); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1126 }
1127}
1128
1129int main() {
1130 testDetails();
1131 testSimple();
1132 testDuplicate();
1133 testConstructionWithVariantType();
1134 testConstructionWithVariantIndex();
1135 testEmplaceWithType();
1136 testEmplaceWithIndex();
1137 testCopy();
1138 testMove();
1
Calling 'testMove'
1139 testDestructor();
1140 testEquality();
1141 testMatching();
1142 testMatchingLambda();
1143 testMatchingLambdaWithIndex();
1144 testMatchingLambdas();
1145 testMatchingLambdasWithIndex();
1146 testAddTagToHash();
1147
1148 printf("TestVariant OK!\n");
1149 return 0;
1150}