Bug Summary

File:root/firefox-clang/mfbt/tests/TestMaybe.cpp
Warning:line 642, column 7
Method called on moved-from object 'src'

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 TestMaybe.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/TestMaybe.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 <type_traits>
6#include <utility>
7
8#include "mozilla/Assertions.h"
9#include "mozilla/Attributes.h"
10#include "mozilla/Maybe.h"
11
12using mozilla::Maybe;
13using mozilla::Nothing;
14using mozilla::Some;
15using mozilla::SomeRef;
16using mozilla::ToMaybe;
17using mozilla::ToMaybeRef;
18
19#define RUN_TEST(t)do { bool cond = (t()); do { static_assert( mozilla::detail::
AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Unexpectedly returned false during test: "
"t" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 19)
; do { } while (false); do { MOZ_CrashSequence(__null, 19); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); cond
= AllDestructorsWereCalled(); do { static_assert( mozilla::detail
::AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
"t" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 19)
; do { } while (false); do { MOZ_CrashSequence(__null, 19); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); } while
(false)
\
20 do { \
21 bool cond = (t()); \
22 MOZ_RELEASE_ASSERT(cond, "Unexpectedly returned false during test: " #t)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(cond)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("cond" " (" "Unexpectedly returned false during test: "
#t ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 22);
do { } while (false); do { MOZ_CrashSequence(__null, 22); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
; \
23 cond = AllDestructorsWereCalled(); \
24 MOZ_RELEASE_ASSERT(cond, \do { static_assert( mozilla::detail::AssertionConditionType<
decltype(cond)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
#t ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 25);
do { } while (false); do { MOZ_CrashSequence(__null, 25); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
25 "Failed to destroy all objects during test: " #t)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(cond)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
#t ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 25);
do { } while (false); do { MOZ_CrashSequence(__null, 25); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
; \
26 } while (false)
27
28enum Status {
29 eWasDefaultConstructed,
30 eWasConstructed,
31 eWasCopyConstructed,
32 eWasMoveConstructed,
33 eWasConstMoveConstructed,
34 eWasAssigned,
35 eWasCopyAssigned,
36 eWasMoveAssigned,
37 eWasCopiedFrom,
38 eWasMovedFrom,
39 eWasConstMovedFrom,
40};
41
42static size_t sUndestroyedObjects = 0;
43
44static bool AllDestructorsWereCalled() { return sUndestroyedObjects == 0; }
45
46struct BasicValue {
47 BasicValue() : mStatus(eWasDefaultConstructed), mTag(0) {
48 ++sUndestroyedObjects;
49 }
50
51 explicit BasicValue(int aTag) : mStatus(eWasConstructed), mTag(aTag) {
52 ++sUndestroyedObjects;
53 }
54
55 BasicValue(const BasicValue& aOther)
56 : mStatus(eWasCopyConstructed), mTag(aOther.mTag) {
57 ++sUndestroyedObjects;
58 }
59
60 BasicValue(BasicValue&& aOther)
61 : mStatus(eWasMoveConstructed), mTag(aOther.mTag) {
62 ++sUndestroyedObjects;
63 aOther.mStatus = eWasMovedFrom;
64 aOther.mTag = 0;
65 }
66
67 BasicValue(const BasicValue&& aOther)
68 : mStatus(eWasConstMoveConstructed), mTag(aOther.mTag) {
69 ++sUndestroyedObjects;
70 aOther.mStatus = eWasConstMovedFrom;
71 }
72
73 ~BasicValue() { --sUndestroyedObjects; }
74
75 BasicValue& operator=(const BasicValue& aOther) {
76 mStatus = eWasCopyAssigned;
77 mTag = aOther.mTag;
78 return *this;
79 }
80
81 BasicValue& operator=(BasicValue&& aOther) {
82 mStatus = eWasMoveAssigned;
83 mTag = aOther.mTag;
84 aOther.mStatus = eWasMovedFrom;
85 aOther.mTag = 0;
86 return *this;
87 }
88
89 bool operator==(const BasicValue& aOther) const {
90 return mTag == aOther.mTag;
91 }
92
93 bool operator<(const BasicValue& aOther) const { return mTag < aOther.mTag; }
94
95 Status GetStatus() const { return mStatus; }
96 void SetTag(int aValue) { mTag = aValue; }
97 int GetTag() const { return mTag; }
98
99 private:
100 mutable Status mStatus;
101 int mTag;
102};
103
104struct UncopyableValue {
105 UncopyableValue() : mStatus(eWasDefaultConstructed) { ++sUndestroyedObjects; }
106
107 UncopyableValue(UncopyableValue&& aOther) : mStatus(eWasMoveConstructed) {
108 ++sUndestroyedObjects;
109 aOther.mStatus = eWasMovedFrom;
110 }
111
112 ~UncopyableValue() { --sUndestroyedObjects; }
113
114 UncopyableValue& operator=(UncopyableValue&& aOther) {
115 mStatus = eWasMoveAssigned;
116 aOther.mStatus = eWasMovedFrom;
117 return *this;
118 }
119
120 Status GetStatus() { return mStatus; }
121
122 private:
123 UncopyableValue(const UncopyableValue& aOther) = delete;
124 UncopyableValue& operator=(const UncopyableValue& aOther) = delete;
125
126 Status mStatus;
127};
128
129struct UnmovableValue {
130 UnmovableValue() : mStatus(eWasDefaultConstructed) { ++sUndestroyedObjects; }
131
132 UnmovableValue(const UnmovableValue& aOther) : mStatus(eWasCopyConstructed) {
133 ++sUndestroyedObjects;
134 }
135
136 ~UnmovableValue() { --sUndestroyedObjects; }
137
138 UnmovableValue& operator=(const UnmovableValue& aOther) {
139 mStatus = eWasCopyAssigned;
140 return *this;
141 }
142
143 Status GetStatus() { return mStatus; }
144
145 UnmovableValue(UnmovableValue&& aOther) = delete;
146 UnmovableValue& operator=(UnmovableValue&& aOther) = delete;
147
148 private:
149 Status mStatus;
150};
151
152struct UncopyableUnmovableValue {
153 UncopyableUnmovableValue() : mStatus(eWasDefaultConstructed) {
154 ++sUndestroyedObjects;
155 }
156
157 explicit UncopyableUnmovableValue(int) : mStatus(eWasConstructed) {
158 ++sUndestroyedObjects;
159 }
160
161 ~UncopyableUnmovableValue() { --sUndestroyedObjects; }
162
163 Status GetStatus() const { return mStatus; }
164
165 private:
166 UncopyableUnmovableValue(const UncopyableUnmovableValue& aOther) = delete;
167 UncopyableUnmovableValue& operator=(const UncopyableUnmovableValue& aOther) =
168 delete;
169 UncopyableUnmovableValue(UncopyableUnmovableValue&& aOther) = delete;
170 UncopyableUnmovableValue& operator=(UncopyableUnmovableValue&& aOther) =
171 delete;
172
173 Status mStatus;
174};
175
176static_assert(std::is_trivially_destructible_v<Maybe<int>>);
177static_assert(std::is_trivially_copy_constructible_v<Maybe<int>>);
178static_assert(std::is_trivially_copy_assignable_v<Maybe<int>>);
179
180static_assert(42 == Some(42).value());
181static_assert(42 == Some(42).valueOr(43));
182static_assert(42 == Maybe<int>{}.valueOr(42));
183static_assert(42 == Some(42).valueOrFrom([] { return 43; }));
184static_assert(42 == Maybe<int>{}.valueOrFrom([] { return 42; }));
185static_assert(Some(43) == [] {
186 auto val = Some(42);
187 val.apply([](int& val) { val += 1; });
188 return val;
189}());
190static_assert(Some(43) == Some(42).map([](int val) { return val + 1; }));
191static_assert(Maybe<int>(std::in_place, 43) ==
192 Maybe<int>(std::in_place, 42).map([](int val) {
193 return val + 1;
194 }));
195
196/* Test we're not using extra bytes to store trivial scalars */
197template <class T>
198struct FakeStorage {
199 T value;
200 char flag;
201};
202
203static_assert(sizeof(FakeStorage<char>) == sizeof(Maybe<char>),
204 "extra padding does not change structure size");
205static_assert(sizeof(FakeStorage<short>) == sizeof(Maybe<short>),
206 "extra padding does not change structure size");
207static_assert(sizeof(FakeStorage<int>) == sizeof(Maybe<int>),
208 "extra padding does not change structure size");
209static_assert(sizeof(FakeStorage<long>) == sizeof(Maybe<long>),
210 "extra padding does not change structure size");
211
212struct TriviallyDestructible {
213 TriviallyDestructible() { // not trivially constructible
214 }
215};
216
217static_assert(std::is_trivially_destructible_v<Maybe<TriviallyDestructible>>);
218
219struct UncopyableValueLiteralType {
220 explicit constexpr UncopyableValueLiteralType(int aValue) : mValue{aValue} {}
221
222 UncopyableValueLiteralType(UncopyableValueLiteralType&&) = default;
223 UncopyableValueLiteralType& operator=(UncopyableValueLiteralType&&) = default;
224
225 int mValue;
226};
227
228static_assert(
229 std::is_trivially_destructible_v<Maybe<UncopyableValueLiteralType>>);
230static_assert(!std::is_copy_constructible_v<Maybe<UncopyableValueLiteralType>>);
231static_assert(!std::is_copy_assignable_v<Maybe<UncopyableValueLiteralType>>);
232static_assert(std::is_move_constructible_v<Maybe<UncopyableValueLiteralType>>);
233static_assert(std::is_move_assignable_v<Maybe<UncopyableValueLiteralType>>);
234
235constexpr Maybe<UncopyableValueLiteralType> someUncopyable =
236 Some(UncopyableValueLiteralType{42});
237static_assert(someUncopyable.isSome());
238static_assert(42 == someUncopyable->mValue);
239
240constexpr Maybe<UncopyableValueLiteralType> someUncopyableAssigned = [] {
241 auto res = Maybe<UncopyableValueLiteralType>{};
242 res = Some(UncopyableValueLiteralType{42});
243 return res;
244}();
245static_assert(someUncopyableAssigned.isSome());
246static_assert(42 == someUncopyableAssigned->mValue);
247
248static bool TestBasicFeatures() {
249 // Check that a Maybe<T> is initialized to Nothing.
250 Maybe<BasicValue> mayValue;
251 static_assert(std::is_same_v<BasicValue, decltype(mayValue)::ValueType>,
252 "Should have BasicValue ValueType");
253 MOZ_RELEASE_ASSERT(!mayValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!mayValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!mayValue))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("!mayValue", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 253); do { } while (false); do { MOZ_CrashSequence(__null, 253
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
254 MOZ_RELEASE_ASSERT(!mayValue.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!mayValue.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!mayValue.isSome()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("!mayValue.isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 254); do { }
while (false); do { MOZ_CrashSequence(__null, 254); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
255 MOZ_RELEASE_ASSERT(mayValue.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue.isNothing()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("mayValue.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 255); do { }
while (false); do { MOZ_CrashSequence(__null, 255); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
256
257 // Check that emplace() default constructs and the accessors work.
258 mayValue.emplace();
259 MOZ_RELEASE_ASSERT(mayValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("mayValue", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 259); do { } while (false); do { MOZ_CrashSequence(__null, 259
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
260 MOZ_RELEASE_ASSERT(mayValue.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue.isSome()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("mayValue.isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 260); do { }
while (false); do { MOZ_CrashSequence(__null, 260); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
261 MOZ_RELEASE_ASSERT(!mayValue.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!mayValue.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!mayValue.isNothing()))), 0)
)) { do { } while (false); MOZ_ReportAssertionFailure("!mayValue.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 261); do { }
while (false); do { MOZ_CrashSequence(__null, 261); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
262 MOZ_RELEASE_ASSERT(*mayValue == BasicValue())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*mayValue == BasicValue())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*mayValue == BasicValue())))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("*mayValue == BasicValue()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 262); do { }
while (false); do { MOZ_CrashSequence(__null, 262); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
263 static_assert(std::is_same_v<BasicValue&, decltype(*mayValue)>,
264 "operator*() should return a BasicValue&");
265 MOZ_RELEASE_ASSERT(mayValue.value() == BasicValue())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.value() == BasicValue())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue.value() == BasicValue
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("mayValue.value() == BasicValue()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 265); do { } while (false); do { MOZ_CrashSequence(__null, 265
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
266 static_assert(std::is_same_v<BasicValue, decltype(mayValue.value())>,
267 "value() should return a BasicValue");
268 MOZ_RELEASE_ASSERT(mayValue.ref() == BasicValue())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.ref() == BasicValue())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue.ref() == BasicValue
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("mayValue.ref() == BasicValue()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 268); do { } while (false); do { MOZ_CrashSequence(__null, 268
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
269 static_assert(std::is_same_v<BasicValue&, decltype(mayValue.ref())>,
270 "ref() should return a BasicValue&");
271 MOZ_RELEASE_ASSERT(mayValue.ptr() != nullptr)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.ptr() != nullptr)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue.ptr() != nullptr)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("mayValue.ptr() != nullptr"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 271); do { }
while (false); do { MOZ_CrashSequence(__null, 271); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
272 static_assert(std::is_same_v<BasicValue*, decltype(mayValue.ptr())>,
273 "ptr() should return a BasicValue*");
274 MOZ_RELEASE_ASSERT(mayValue->GetStatus() == eWasDefaultConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue->GetStatus() == eWasDefaultConstructed)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayValue->GetStatus() == eWasDefaultConstructed))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("mayValue->GetStatus() == eWasDefaultConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 274); do { }
while (false); do { MOZ_CrashSequence(__null, 274); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
275
276 // Check that reset() works.
277 mayValue.reset();
278 MOZ_RELEASE_ASSERT(!mayValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!mayValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!mayValue))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("!mayValue", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 278); do { } while (false); do { MOZ_CrashSequence(__null, 278
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
279 MOZ_RELEASE_ASSERT(!mayValue.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!mayValue.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!mayValue.isSome()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("!mayValue.isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 279); do { }
while (false); do { MOZ_CrashSequence(__null, 279); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
280 MOZ_RELEASE_ASSERT(mayValue.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue.isNothing()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("mayValue.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 280); do { }
while (false); do { MOZ_CrashSequence(__null, 280); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
281
282 // Check that emplace(T1) calls the correct constructor.
283 mayValue.emplace(1);
284 MOZ_RELEASE_ASSERT(mayValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("mayValue", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 284); do { } while (false); do { MOZ_CrashSequence(__null, 284
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
285 MOZ_RELEASE_ASSERT(mayValue->GetStatus() == eWasConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue->GetStatus() == eWasConstructed)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(mayValue->GetStatus() == eWasConstructed))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("mayValue->GetStatus() == eWasConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 285); do { }
while (false); do { MOZ_CrashSequence(__null, 285); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
286 MOZ_RELEASE_ASSERT(mayValue->GetTag() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue->GetTag() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue->GetTag() == 1))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("mayValue->GetTag() == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 286); do { }
while (false); do { MOZ_CrashSequence(__null, 286); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
287 mayValue.reset();
288 MOZ_RELEASE_ASSERT(!mayValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!mayValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!mayValue))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("!mayValue", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 288); do { } while (false); do { MOZ_CrashSequence(__null, 288
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
289
290 {
291 // Check that Maybe(std::in_place, T1) calls the correct constructor.
292 const auto mayValueConstructed = Maybe<BasicValue>(std::in_place, 1);
293 MOZ_RELEASE_ASSERT(mayValueConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValueConstructed)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValueConstructed))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("mayValueConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 293); do { }
while (false); do { MOZ_CrashSequence(__null, 293); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
294 MOZ_RELEASE_ASSERT(mayValueConstructed->GetStatus() == eWasConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValueConstructed->GetStatus() == eWasConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayValueConstructed->GetStatus() == eWasConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayValueConstructed->GetStatus() == eWasConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 294); do { } while (false); do { MOZ_CrashSequence(__null, 294
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
295 MOZ_RELEASE_ASSERT(mayValueConstructed->GetTag() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValueConstructed->GetTag() == 1)>::isValid,
"invalid assertion condition"); if ((__builtin_expect(!!(!(!
!(mayValueConstructed->GetTag() == 1))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("mayValueConstructed->GetTag() == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 295); do { }
while (false); do { MOZ_CrashSequence(__null, 295); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
296 }
297
298 // Check that Some() and Nothing() work.
299 mayValue = Some(BasicValue(2));
300 MOZ_RELEASE_ASSERT(mayValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("mayValue", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 300); do { } while (false); do { MOZ_CrashSequence(__null, 300
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
301 MOZ_RELEASE_ASSERT(mayValue->GetStatus() == eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue->GetStatus() == eWasMoveConstructed)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayValue->GetStatus() == eWasMoveConstructed))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("mayValue->GetStatus() == eWasMoveConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 301); do { }
while (false); do { MOZ_CrashSequence(__null, 301); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
302 MOZ_RELEASE_ASSERT(mayValue->GetTag() == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue->GetTag() == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue->GetTag() == 2))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("mayValue->GetTag() == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 302); do { }
while (false); do { MOZ_CrashSequence(__null, 302); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
303 mayValue = Nothing();
304 MOZ_RELEASE_ASSERT(!mayValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!mayValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!mayValue))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("!mayValue", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 304); do { } while (false); do { MOZ_CrashSequence(__null, 304
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
305
306 // Check that the accessors work through a const ref.
307 mayValue.emplace();
308 const Maybe<BasicValue>& mayValueCRef = mayValue;
309 MOZ_RELEASE_ASSERT(mayValueCRef)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValueCRef)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValueCRef))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("mayValueCRef", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 309); do { } while (false); do { MOZ_CrashSequence(__null, 309
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
310 MOZ_RELEASE_ASSERT(mayValueCRef.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValueCRef.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValueCRef.isSome()))), 0)
)) { do { } while (false); MOZ_ReportAssertionFailure("mayValueCRef.isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 310); do { }
while (false); do { MOZ_CrashSequence(__null, 310); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
311 MOZ_RELEASE_ASSERT(!mayValueCRef.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!mayValueCRef.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!mayValueCRef.isNothing())))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("!mayValueCRef.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 311); do { }
while (false); do { MOZ_CrashSequence(__null, 311); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
312 MOZ_RELEASE_ASSERT(*mayValueCRef == BasicValue())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*mayValueCRef == BasicValue())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*mayValueCRef == BasicValue(
)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("*mayValueCRef == BasicValue()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 312); do { } while (false); do { MOZ_CrashSequence(__null, 312
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
313 static_assert(std::is_same_v<const BasicValue&, decltype(*mayValueCRef)>,
314 "operator*() should return a BasicValue");
315 MOZ_RELEASE_ASSERT(mayValueCRef.value() == BasicValue())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValueCRef.value() == BasicValue())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValueCRef.value() == BasicValue
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("mayValueCRef.value() == BasicValue()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 315); do { } while (false); do { MOZ_CrashSequence(__null, 315
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
316 static_assert(std::is_same_v<BasicValue, decltype(mayValueCRef.value())>,
317 "value() should return a BasicValue");
318 MOZ_RELEASE_ASSERT(mayValueCRef.ref() == BasicValue())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValueCRef.ref() == BasicValue())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValueCRef.ref() == BasicValue
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("mayValueCRef.ref() == BasicValue()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 318); do { } while (false); do { MOZ_CrashSequence(__null, 318
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
319 static_assert(std::is_same_v<const BasicValue&, decltype(mayValueCRef.ref())>,
320 "ref() should return a const BasicValue&");
321 MOZ_RELEASE_ASSERT(mayValueCRef.ptr() != nullptr)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValueCRef.ptr() != nullptr)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValueCRef.ptr() != nullptr
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayValueCRef.ptr() != nullptr", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 321); do { } while (false); do { MOZ_CrashSequence(__null, 321
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
322 static_assert(std::is_same_v<const BasicValue*, decltype(mayValueCRef.ptr())>,
323 "ptr() should return a const BasicValue*");
324 MOZ_RELEASE_ASSERT(mayValueCRef->GetStatus() == eWasDefaultConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValueCRef->GetStatus() == eWasDefaultConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayValueCRef->GetStatus() == eWasDefaultConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayValueCRef->GetStatus() == eWasDefaultConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 324); do { } while (false); do { MOZ_CrashSequence(__null, 324
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
325 mayValue.reset();
326
327 // Check that we can create and reference Maybe<const Type>.
328 Maybe<const BasicValue> mayCValue1 = Some(BasicValue(5));
329 MOZ_RELEASE_ASSERT(mayCValue1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayCValue1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayCValue1))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("mayCValue1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 329); do { } while (false); do { MOZ_CrashSequence(__null, 329
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
330 MOZ_RELEASE_ASSERT(mayCValue1.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayCValue1.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayCValue1.isSome()))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("mayCValue1.isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 330); do { }
while (false); do { MOZ_CrashSequence(__null, 330); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
331 MOZ_RELEASE_ASSERT(*mayCValue1 == BasicValue(5))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*mayCValue1 == BasicValue(5))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*mayCValue1 == BasicValue(5)
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"*mayCValue1 == BasicValue(5)", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 331); do { } while (false); do { MOZ_CrashSequence(__null, 331
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
332 const Maybe<const BasicValue>& mayCValue1Ref = mayCValue1;
333 MOZ_RELEASE_ASSERT(mayCValue1Ref == mayCValue1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayCValue1Ref == mayCValue1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayCValue1Ref == mayCValue1)
)), 0))) { do { } while (false); MOZ_ReportAssertionFailure("mayCValue1Ref == mayCValue1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 333); do { }
while (false); do { MOZ_CrashSequence(__null, 333); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
334 MOZ_RELEASE_ASSERT(*mayCValue1Ref == BasicValue(5))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*mayCValue1Ref == BasicValue(5))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*mayCValue1Ref == BasicValue
(5)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("*mayCValue1Ref == BasicValue(5)", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 334); do { } while (false); do { MOZ_CrashSequence(__null, 334
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
335 Maybe<const BasicValue> mayCValue2;
336 mayCValue2.emplace(6);
337 MOZ_RELEASE_ASSERT(mayCValue2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayCValue2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayCValue2))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("mayCValue2", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 337); do { } while (false); do { MOZ_CrashSequence(__null, 337
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
338 MOZ_RELEASE_ASSERT(mayCValue2.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayCValue2.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayCValue2.isSome()))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("mayCValue2.isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 338); do { }
while (false); do { MOZ_CrashSequence(__null, 338); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
339 MOZ_RELEASE_ASSERT(*mayCValue2 == BasicValue(6))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*mayCValue2 == BasicValue(6))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*mayCValue2 == BasicValue(6)
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"*mayCValue2 == BasicValue(6)", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 339); do { } while (false); do { MOZ_CrashSequence(__null, 339
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
340
341 // Check that accessors work through rvalue-references.
342 MOZ_RELEASE_ASSERT(Some(BasicValue()))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Some(BasicValue()))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(Some(BasicValue())))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("Some(BasicValue())"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 342); do { }
while (false); do { MOZ_CrashSequence(__null, 342); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
343 MOZ_RELEASE_ASSERT(Some(BasicValue()).isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Some(BasicValue()).isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(Some(BasicValue()).isSome())
)), 0))) { do { } while (false); MOZ_ReportAssertionFailure("Some(BasicValue()).isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 343); do { }
while (false); do { MOZ_CrashSequence(__null, 343); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
344 MOZ_RELEASE_ASSERT(!Some(BasicValue()).isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!Some(BasicValue()).isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!Some(BasicValue()).isNothing
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("!Some(BasicValue()).isNothing()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 344); do { } while (false); do { MOZ_CrashSequence(__null, 344
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
345 MOZ_RELEASE_ASSERT(*Some(BasicValue()) == BasicValue())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*Some(BasicValue()) == BasicValue())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*Some(BasicValue()) == BasicValue
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("*Some(BasicValue()) == BasicValue()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 345); do { } while (false); do { MOZ_CrashSequence(__null, 345
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
346 static_assert(std::is_same_v<BasicValue&&, decltype(*Some(BasicValue()))>,
347 "operator*() should return a BasicValue&&");
348 MOZ_RELEASE_ASSERT(Some(BasicValue()).value() == BasicValue())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Some(BasicValue()).value() == BasicValue())>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(Some(BasicValue()).value() == BasicValue()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("Some(BasicValue()).value() == BasicValue()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 348); do { }
while (false); do { MOZ_CrashSequence(__null, 348); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
349 static_assert(
350 std::is_same_v<BasicValue, decltype(Some(BasicValue()).value())>,
351 "value() should return a BasicValue");
352 MOZ_RELEASE_ASSERT(Some(BasicValue()).ref() == BasicValue())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Some(BasicValue()).ref() == BasicValue())>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(Some(BasicValue()).ref() == BasicValue()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("Some(BasicValue()).ref() == BasicValue()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 352); do { }
while (false); do { MOZ_CrashSequence(__null, 352); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
353 static_assert(
354 std::is_same_v<BasicValue&&, decltype(Some(BasicValue()).ref())>,
355 "ref() should return a BasicValue&&");
356 MOZ_RELEASE_ASSERT(Some(BasicValue()).ptr() != nullptr)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Some(BasicValue()).ptr() != nullptr)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(Some(BasicValue()).ptr() != nullptr
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"Some(BasicValue()).ptr() != nullptr", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 356); do { } while (false); do { MOZ_CrashSequence(__null, 356
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
357 static_assert(std::is_same_v<BasicValue*, decltype(Some(BasicValue()).ptr())>,
358 "ptr() should return a BasicValue*");
359 MOZ_RELEASE_ASSERT(Some(BasicValue())->GetStatus() == eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Some(BasicValue())->GetStatus() == eWasMoveConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(Some(BasicValue())->GetStatus() == eWasMoveConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"Some(BasicValue())->GetStatus() == eWasMoveConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 359); do { } while (false); do { MOZ_CrashSequence(__null, 359
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
360
361 // Check that accessors work through const-rvalue-references.
362 auto MakeConstMaybe = []() -> const Maybe<BasicValue> {
363 return Some(BasicValue());
364 };
365 MOZ_RELEASE_ASSERT(MakeConstMaybe())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(MakeConstMaybe())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(MakeConstMaybe()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("MakeConstMaybe()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 365); do { }
while (false); do { MOZ_CrashSequence(__null, 365); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
366 MOZ_RELEASE_ASSERT(MakeConstMaybe().isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(MakeConstMaybe().isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(MakeConstMaybe().isSome())))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("MakeConstMaybe().isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 366); do { }
while (false); do { MOZ_CrashSequence(__null, 366); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
367 MOZ_RELEASE_ASSERT(!MakeConstMaybe().isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!MakeConstMaybe().isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!MakeConstMaybe().isNothing(
)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("!MakeConstMaybe().isNothing()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 367); do { } while (false); do { MOZ_CrashSequence(__null, 367
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
368 MOZ_RELEASE_ASSERT(*MakeConstMaybe() == BasicValue())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*MakeConstMaybe() == BasicValue())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*MakeConstMaybe() == BasicValue
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("*MakeConstMaybe() == BasicValue()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 368); do { } while (false); do { MOZ_CrashSequence(__null, 368
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
369 static_assert(std::is_same_v<const BasicValue&&, decltype(*MakeConstMaybe())>,
370 "operator*() should return a const BasicValue&&");
371 MOZ_RELEASE_ASSERT(MakeConstMaybe().value() == BasicValue())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(MakeConstMaybe().value() == BasicValue())>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(MakeConstMaybe().value() == BasicValue()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("MakeConstMaybe().value() == BasicValue()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 371); do { }
while (false); do { MOZ_CrashSequence(__null, 371); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
372 static_assert(std::is_same_v<BasicValue, decltype(MakeConstMaybe().value())>,
373 "value() should return a BasicValue");
374 MOZ_RELEASE_ASSERT(MakeConstMaybe().ref() == BasicValue())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(MakeConstMaybe().ref() == BasicValue())>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(MakeConstMaybe().ref() == BasicValue()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("MakeConstMaybe().ref() == BasicValue()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 374); do { }
while (false); do { MOZ_CrashSequence(__null, 374); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
375 static_assert(
376 std::is_same_v<const BasicValue&&, decltype(MakeConstMaybe().ref())>,
377 "ref() should return a const BasicValue&&");
378 MOZ_RELEASE_ASSERT(MakeConstMaybe().ptr() != nullptr)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(MakeConstMaybe().ptr() != nullptr)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(MakeConstMaybe().ptr() != nullptr
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"MakeConstMaybe().ptr() != nullptr", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 378); do { } while (false); do { MOZ_CrashSequence(__null, 378
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
379 static_assert(
380 std::is_same_v<const BasicValue*, decltype(MakeConstMaybe().ptr())>,
381 "ptr() should return a const BasicValue*");
382 MOZ_RELEASE_ASSERT(MakeConstMaybe()->GetStatus() == eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(MakeConstMaybe()->GetStatus() == eWasMoveConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(MakeConstMaybe()->GetStatus() == eWasMoveConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"MakeConstMaybe()->GetStatus() == eWasMoveConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 382); do { } while (false); do { MOZ_CrashSequence(__null, 382
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
383 MOZ_RELEASE_ASSERT(BasicValue(*MakeConstMaybe()).GetStatus() ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(BasicValue(*MakeConstMaybe()).GetStatus() == eWasConstMoveConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(BasicValue(*MakeConstMaybe()).GetStatus() == eWasConstMoveConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"BasicValue(*MakeConstMaybe()).GetStatus() == eWasConstMoveConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 384); do { }
while (false); do { MOZ_CrashSequence(__null, 384); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
384 eWasConstMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(BasicValue(*MakeConstMaybe()).GetStatus() == eWasConstMoveConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(BasicValue(*MakeConstMaybe()).GetStatus() == eWasConstMoveConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"BasicValue(*MakeConstMaybe()).GetStatus() == eWasConstMoveConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 384); do { }
while (false); do { MOZ_CrashSequence(__null, 384); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
385
386 // Check that take works
387 mayValue = Some(BasicValue(6));
388 Maybe taken = mayValue.take();
389 MOZ_RELEASE_ASSERT(taken->GetStatus() == eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(taken->GetStatus() == eWasMoveConstructed)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(taken->GetStatus() == eWasMoveConstructed))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("taken->GetStatus() == eWasMoveConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 389); do { }
while (false); do { MOZ_CrashSequence(__null, 389); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
390 MOZ_RELEASE_ASSERT(taken == Some(BasicValue(6)))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(taken == Some(BasicValue(6)))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(taken == Some(BasicValue(6))
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"taken == Some(BasicValue(6))", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 390); do { } while (false); do { MOZ_CrashSequence(__null, 390
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
391 MOZ_RELEASE_ASSERT(!mayValue.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!mayValue.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!mayValue.isSome()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("!mayValue.isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 391); do { }
while (false); do { MOZ_CrashSequence(__null, 391); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
392 MOZ_RELEASE_ASSERT(mayValue.take() == Nothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.take() == Nothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue.take() == Nothing()
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayValue.take() == Nothing()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 392); do { } while (false); do { MOZ_CrashSequence(__null, 392
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
393
394 // Check that extract works
395 mayValue = Some(BasicValue(7));
396 BasicValue extracted = mayValue.extract();
397 MOZ_RELEASE_ASSERT(extracted.GetStatus() == eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(extracted.GetStatus() == eWasMoveConstructed)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(extracted.GetStatus() == eWasMoveConstructed))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("extracted.GetStatus() == eWasMoveConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 397); do { }
while (false); do { MOZ_CrashSequence(__null, 397); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
398 MOZ_RELEASE_ASSERT(extracted == BasicValue(7))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(extracted == BasicValue(7))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(extracted == BasicValue(7)))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("extracted == BasicValue(7)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 398); do { }
while (false); do { MOZ_CrashSequence(__null, 398); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
399 MOZ_RELEASE_ASSERT(!mayValue.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!mayValue.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!mayValue.isSome()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("!mayValue.isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 399); do { }
while (false); do { MOZ_CrashSequence(__null, 399); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
400
401 return true;
402}
403
404template <typename T>
405static void TestCopyMaybe() {
406 {
407 MOZ_RELEASE_ASSERT(0 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(0 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(0 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("0 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 407); do { }
while (false); do { MOZ_CrashSequence(__null, 407); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
408
409 Maybe<T> src = Some(T());
410 Maybe<T> dstCopyConstructed = src;
411
412 MOZ_RELEASE_ASSERT(2 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(2 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(2 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("2 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 412); do { }
while (false); do { MOZ_CrashSequence(__null, 412); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
413 MOZ_RELEASE_ASSERT(dstCopyConstructed->GetStatus() == eWasCopyConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dstCopyConstructed->GetStatus() == eWasCopyConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(dstCopyConstructed->GetStatus() == eWasCopyConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"dstCopyConstructed->GetStatus() == eWasCopyConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 413); do { } while (false); do { MOZ_CrashSequence(__null, 413
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
414 }
415
416 {
417 MOZ_RELEASE_ASSERT(0 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(0 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(0 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("0 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 417); do { }
while (false); do { MOZ_CrashSequence(__null, 417); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
418
419 Maybe<T> src = Some(T());
420 Maybe<T> dstCopyAssigned;
421 dstCopyAssigned = src;
422
423 MOZ_RELEASE_ASSERT(2 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(2 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(2 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("2 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 423); do { }
while (false); do { MOZ_CrashSequence(__null, 423); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
424 MOZ_RELEASE_ASSERT(dstCopyAssigned->GetStatus() == eWasCopyConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dstCopyAssigned->GetStatus() == eWasCopyConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(dstCopyAssigned->GetStatus() == eWasCopyConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"dstCopyAssigned->GetStatus() == eWasCopyConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 424); do { } while (false); do { MOZ_CrashSequence(__null, 424
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
425 }
426}
427
428template <typename T>
429static void TestMoveMaybe() {
430 {
431 MOZ_RELEASE_ASSERT(0 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(0 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(0 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("0 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 431); do { }
while (false); do { MOZ_CrashSequence(__null, 431); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
432
433 Maybe<T> src = Some(T());
434 Maybe<T> dstMoveConstructed = std::move(src);
435
436 MOZ_RELEASE_ASSERT(1 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(1 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(1 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("1 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 436); do { }
while (false); do { MOZ_CrashSequence(__null, 436); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
437 MOZ_RELEASE_ASSERT(dstMoveConstructed->GetStatus() == eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dstMoveConstructed->GetStatus() == eWasMoveConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(dstMoveConstructed->GetStatus() == eWasMoveConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"dstMoveConstructed->GetStatus() == eWasMoveConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 437); do { } while (false); do { MOZ_CrashSequence(__null, 437
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
438 }
439
440 {
441 MOZ_RELEASE_ASSERT(0 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(0 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(0 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("0 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 441); do { }
while (false); do { MOZ_CrashSequence(__null, 441); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
442
443 Maybe<T> src = Some(T());
444 Maybe<T> dstMoveAssigned;
445 dstMoveAssigned = std::move(src);
446
447 MOZ_RELEASE_ASSERT(1 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(1 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(1 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("1 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 447); do { }
while (false); do { MOZ_CrashSequence(__null, 447); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
448 MOZ_RELEASE_ASSERT(dstMoveAssigned->GetStatus() == eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dstMoveAssigned->GetStatus() == eWasMoveConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(dstMoveAssigned->GetStatus() == eWasMoveConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"dstMoveAssigned->GetStatus() == eWasMoveConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 448); do { } while (false); do { MOZ_CrashSequence(__null, 448
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
449 }
450
451 {
452 MOZ_RELEASE_ASSERT(0 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(0 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(0 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("0 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 452); do { }
while (false); do { MOZ_CrashSequence(__null, 452); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
453
454 Maybe<T> src = Some(T());
455 Maybe<T> dstMoveConstructed = src.take();
456
457 MOZ_RELEASE_ASSERT(1 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(1 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(1 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("1 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 457); do { }
while (false); do { MOZ_CrashSequence(__null, 457); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
458 MOZ_RELEASE_ASSERT(dstMoveConstructed->GetStatus() == eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dstMoveConstructed->GetStatus() == eWasMoveConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(dstMoveConstructed->GetStatus() == eWasMoveConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"dstMoveConstructed->GetStatus() == eWasMoveConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 458); do { } while (false); do { MOZ_CrashSequence(__null, 458
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
459 }
460
461 {
462 MOZ_RELEASE_ASSERT(0 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(0 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(0 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("0 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 462); do { }
while (false); do { MOZ_CrashSequence(__null, 462); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
463
464 Maybe<T> src = Some(T());
465 T dstMoveConstructed = src.extract();
466
467 MOZ_RELEASE_ASSERT(1 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(1 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(1 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("1 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 467); do { }
while (false); do { MOZ_CrashSequence(__null, 467); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
468 MOZ_RELEASE_ASSERT(dstMoveConstructed.GetStatus() == eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dstMoveConstructed.GetStatus() == eWasMoveConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(dstMoveConstructed.GetStatus() == eWasMoveConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"dstMoveConstructed.GetStatus() == eWasMoveConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 468); do { } while (false); do { MOZ_CrashSequence(__null, 468
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
469 }
470}
471
472static bool TestCopyAndMove() {
473 MOZ_RELEASE_ASSERT(0 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(0 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(0 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("0 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 473); do { }
while (false); do { MOZ_CrashSequence(__null, 473); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1
Assuming 'sUndestroyedObjects' is equal to 0
2
Taking false branch
3
Loop condition is false. Exiting loop
474
475 {
476 // Check that we get moves when possible for types that can support both
477 // moves and copies.
478 {
479 Maybe<BasicValue> mayBasicValue = Some(BasicValue(1));
480 MOZ_RELEASE_ASSERT(1 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(1 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(1 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("1 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 480); do { }
while (false); do { MOZ_CrashSequence(__null, 480); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
4
Assuming 'sUndestroyedObjects' is equal to 1
5
Taking false branch
6
Loop condition is false. Exiting loop
481 MOZ_RELEASE_ASSERT(mayBasicValue->GetStatus() == eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue->GetStatus() == eWasMoveConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayBasicValue->GetStatus() == eWasMoveConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayBasicValue->GetStatus() == eWasMoveConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 481); do { } while (false); do { MOZ_CrashSequence(__null, 481
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
7
Assuming the condition is true
8
Taking false branch
9
Loop condition is false. Exiting loop
482 MOZ_RELEASE_ASSERT(mayBasicValue->GetTag() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue->GetTag() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayBasicValue->GetTag() ==
1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("mayBasicValue->GetTag() == 1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 482); do { } while (false); do { MOZ_CrashSequence(__null, 482
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
10
Assuming the condition is true
11
Taking false branch
12
Loop condition is false. Exiting loop
483 mayBasicValue = Some(BasicValue(2));
484 MOZ_RELEASE_ASSERT(1 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(1 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(1 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("1 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 484); do { }
while (false); do { MOZ_CrashSequence(__null, 484); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
13
Assuming 'sUndestroyedObjects' is equal to 1
14
Taking false branch
15
Loop condition is false. Exiting loop
485 MOZ_RELEASE_ASSERT(mayBasicValue->GetStatus() == eWasMoveAssigned)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue->GetStatus() == eWasMoveAssigned)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayBasicValue->GetStatus() == eWasMoveAssigned)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("mayBasicValue->GetStatus() == eWasMoveAssigned"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 485); do { }
while (false); do { MOZ_CrashSequence(__null, 485); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
16
Assuming the condition is true
17
Taking false branch
18
Loop condition is false. Exiting loop
486 MOZ_RELEASE_ASSERT(mayBasicValue->GetTag() == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue->GetTag() == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayBasicValue->GetTag() ==
2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("mayBasicValue->GetTag() == 2", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 486); do { } while (false); do { MOZ_CrashSequence(__null, 486
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
19
Assuming the condition is true
20
Taking false branch
21
Loop condition is false. Exiting loop
487 mayBasicValue.reset();
488 MOZ_RELEASE_ASSERT(0 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(0 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(0 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("0 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 488); do { }
while (false); do { MOZ_CrashSequence(__null, 488); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
22
Assuming 'sUndestroyedObjects' is equal to 0
23
Taking false branch
24
Loop condition is false. Exiting loop
489 mayBasicValue.emplace(BasicValue(3));
490 MOZ_RELEASE_ASSERT(1 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(1 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(1 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("1 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 490); do { }
while (false); do { MOZ_CrashSequence(__null, 490); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
25
Assuming 'sUndestroyedObjects' is equal to 1
26
Taking false branch
27
Loop condition is false. Exiting loop
491 MOZ_RELEASE_ASSERT(mayBasicValue->GetStatus() == eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue->GetStatus() == eWasMoveConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayBasicValue->GetStatus() == eWasMoveConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayBasicValue->GetStatus() == eWasMoveConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 491); do { } while (false); do { MOZ_CrashSequence(__null, 491
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
28
Assuming the condition is true
29
Taking false branch
30
Loop condition is false. Exiting loop
492 MOZ_RELEASE_ASSERT(mayBasicValue->GetTag() == 3)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue->GetTag() == 3)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayBasicValue->GetTag() ==
3))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("mayBasicValue->GetTag() == 3", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 492); do { } while (false); do { MOZ_CrashSequence(__null, 492
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
31
Assuming the condition is true
32
Taking false branch
33
Loop condition is false. Exiting loop
493
494 // Check that we get copies when moves aren't possible.
495 Maybe<BasicValue> mayBasicValue2 = Some(*mayBasicValue);
496 MOZ_RELEASE_ASSERT(mayBasicValue2->GetStatus() == eWasCopyConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue2->GetStatus() == eWasCopyConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayBasicValue2->GetStatus() == eWasCopyConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayBasicValue2->GetStatus() == eWasCopyConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 496); do { } while (false); do { MOZ_CrashSequence(__null, 496
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
34
Assuming the condition is true
35
Taking false branch
36
Loop condition is false. Exiting loop
497 MOZ_RELEASE_ASSERT(mayBasicValue2->GetTag() == 3)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue2->GetTag() == 3)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayBasicValue2->GetTag() ==
3))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("mayBasicValue2->GetTag() == 3", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 497); do { } while (false); do { MOZ_CrashSequence(__null, 497
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
37
Assuming the condition is true
38
Taking false branch
39
Loop condition is false. Exiting loop
498 mayBasicValue->SetTag(4);
499 mayBasicValue2 = mayBasicValue;
500 // This test should work again when we fix bug 1052940.
501 // MOZ_RELEASE_ASSERT(mayBasicValue2->GetStatus() == eWasCopyAssigned);
502 MOZ_RELEASE_ASSERT(mayBasicValue2->GetTag() == 4)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue2->GetTag() == 4)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayBasicValue2->GetTag() ==
4))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("mayBasicValue2->GetTag() == 4", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 502); do { } while (false); do { MOZ_CrashSequence(__null, 502
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
40
Assuming the condition is true
41
Taking false branch
42
Loop condition is false. Exiting loop
503 mayBasicValue->SetTag(5);
504 mayBasicValue2.reset();
505 mayBasicValue2.emplace(*mayBasicValue);
506 MOZ_RELEASE_ASSERT(mayBasicValue2->GetStatus() == eWasCopyConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue2->GetStatus() == eWasCopyConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayBasicValue2->GetStatus() == eWasCopyConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayBasicValue2->GetStatus() == eWasCopyConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 506); do { } while (false); do { MOZ_CrashSequence(__null, 506
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
43
Assuming the condition is true
44
Taking false branch
45
Loop condition is false. Exiting loop
507 MOZ_RELEASE_ASSERT(mayBasicValue2->GetTag() == 5)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue2->GetTag() == 5)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayBasicValue2->GetTag() ==
5))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("mayBasicValue2->GetTag() == 5", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 507); do { } while (false); do { MOZ_CrashSequence(__null, 507
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
46
Assuming the condition is true
47
Taking false branch
48
Loop condition is false. Exiting loop
508
509 // Check that std::move() works. (Another sanity check for move support.)
510 Maybe<BasicValue> mayBasicValue3 = Some(std::move(*mayBasicValue));
511 MOZ_RELEASE_ASSERT(mayBasicValue3->GetStatus() == eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue3->GetStatus() == eWasMoveConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayBasicValue3->GetStatus() == eWasMoveConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayBasicValue3->GetStatus() == eWasMoveConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 511); do { } while (false); do { MOZ_CrashSequence(__null, 511
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
49
Assuming the condition is true
50
Taking false branch
51
Loop condition is false. Exiting loop
512 MOZ_RELEASE_ASSERT(mayBasicValue3->GetTag() == 5)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue3->GetTag() == 5)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayBasicValue3->GetTag() ==
5))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("mayBasicValue3->GetTag() == 5", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 512); do { } while (false); do { MOZ_CrashSequence(__null, 512
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
52
Assuming the condition is true
53
Taking false branch
54
Loop condition is false. Exiting loop
513 MOZ_RELEASE_ASSERT(mayBasicValue->GetStatus() == eWasMovedFrom)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue->GetStatus() == eWasMovedFrom)>::
isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayBasicValue->GetStatus() == eWasMovedFrom))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("mayBasicValue->GetStatus() == eWasMovedFrom"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 513); do { }
while (false); do { MOZ_CrashSequence(__null, 513); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
55
Assuming the condition is true
56
Taking false branch
57
Loop condition is false. Exiting loop
514 mayBasicValue2->SetTag(6);
515 mayBasicValue3 = Some(std::move(*mayBasicValue2));
516 MOZ_RELEASE_ASSERT(mayBasicValue3->GetStatus() == eWasMoveAssigned)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue3->GetStatus() == eWasMoveAssigned)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayBasicValue3->GetStatus() == eWasMoveAssigned))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("mayBasicValue3->GetStatus() == eWasMoveAssigned"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 516); do { }
while (false); do { MOZ_CrashSequence(__null, 516); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
58
Assuming the condition is true
59
Taking false branch
60
Loop condition is false. Exiting loop
517 MOZ_RELEASE_ASSERT(mayBasicValue3->GetTag() == 6)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue3->GetTag() == 6)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayBasicValue3->GetTag() ==
6))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("mayBasicValue3->GetTag() == 6", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 517); do { } while (false); do { MOZ_CrashSequence(__null, 517
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
61
Assuming the condition is true
62
Taking false branch
63
Loop condition is false. Exiting loop
518 MOZ_RELEASE_ASSERT(mayBasicValue2->GetStatus() == eWasMovedFrom)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue2->GetStatus() == eWasMovedFrom)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayBasicValue2->GetStatus() == eWasMovedFrom))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("mayBasicValue2->GetStatus() == eWasMovedFrom"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 518); do { }
while (false); do { MOZ_CrashSequence(__null, 518); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
64
Assuming the condition is true
65
Taking false branch
66
Loop condition is false. Exiting loop
519 Maybe<BasicValue> mayBasicValue4;
520 mayBasicValue4.emplace(std::move(*mayBasicValue3));
521 MOZ_RELEASE_ASSERT(mayBasicValue4->GetStatus() == eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue4->GetStatus() == eWasMoveConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayBasicValue4->GetStatus() == eWasMoveConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayBasicValue4->GetStatus() == eWasMoveConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 521); do { } while (false); do { MOZ_CrashSequence(__null, 521
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
67
Assuming the condition is true
68
Taking false branch
69
Loop condition is false. Exiting loop
522 MOZ_RELEASE_ASSERT(mayBasicValue4->GetTag() == 6)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue4->GetTag() == 6)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayBasicValue4->GetTag() ==
6))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("mayBasicValue4->GetTag() == 6", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 522); do { } while (false); do { MOZ_CrashSequence(__null, 522
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
70
Assuming the condition is true
71
Taking false branch
72
Loop condition is false. Exiting loop
523 MOZ_RELEASE_ASSERT(mayBasicValue3->GetStatus() == eWasMovedFrom)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayBasicValue3->GetStatus() == eWasMovedFrom)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayBasicValue3->GetStatus() == eWasMovedFrom))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("mayBasicValue3->GetStatus() == eWasMovedFrom"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 523); do { }
while (false); do { MOZ_CrashSequence(__null, 523); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
73
Assuming the condition is true
74
Taking false branch
75
Loop condition is false. Exiting loop
524 }
525
526 TestCopyMaybe<BasicValue>();
527 TestMoveMaybe<BasicValue>();
528 }
529
530 MOZ_RELEASE_ASSERT(0 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(0 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(0 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("0 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 530); do { }
while (false); do { MOZ_CrashSequence(__null, 530); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
76
Assuming 'sUndestroyedObjects' is equal to 0
77
Taking false branch
78
Loop condition is false. Exiting loop
531
532 {
533 // Check that we always get copies for types that don't support moves.
534 {
535 Maybe<UnmovableValue> mayUnmovableValue = Some(UnmovableValue());
536 MOZ_RELEASE_ASSERT(mayUnmovableValue->GetStatus() == eWasCopyConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayUnmovableValue->GetStatus() == eWasCopyConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayUnmovableValue->GetStatus() == eWasCopyConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayUnmovableValue->GetStatus() == eWasCopyConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 536); do { } while (false); do { MOZ_CrashSequence(__null, 536
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
79
Assuming the condition is true
80
Taking false branch
81
Loop condition is false. Exiting loop
537 mayUnmovableValue.reset();
538 mayUnmovableValue.emplace(UnmovableValue());
539 MOZ_RELEASE_ASSERT(mayUnmovableValue->GetStatus() == eWasCopyConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayUnmovableValue->GetStatus() == eWasCopyConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayUnmovableValue->GetStatus() == eWasCopyConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayUnmovableValue->GetStatus() == eWasCopyConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 539); do { } while (false); do { MOZ_CrashSequence(__null, 539
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
82
Assuming the condition is true
83
Taking false branch
84
Loop condition is false. Exiting loop
540 }
541
542 TestCopyMaybe<UnmovableValue>();
543
544 static_assert(std::is_copy_constructible_v<Maybe<UnmovableValue>>);
545 static_assert(std::is_copy_assignable_v<Maybe<UnmovableValue>>);
546 static_assert(!std::is_move_constructible_v<Maybe<UnmovableValue>>);
547 static_assert(!std::is_move_assignable_v<Maybe<UnmovableValue>>);
548 }
549
550 MOZ_RELEASE_ASSERT(0 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(0 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(0 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("0 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 550); do { }
while (false); do { MOZ_CrashSequence(__null, 550); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
85
Assuming 'sUndestroyedObjects' is equal to 0
86
Taking false branch
87
Loop condition is false. Exiting loop
551
552 {
553 // Check that types that only support moves, but not copies, work.
554 {
555 Maybe<UncopyableValue> mayUncopyableValue = Some(UncopyableValue());
556 MOZ_RELEASE_ASSERT(mayUncopyableValue->GetStatus() ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayUncopyableValue->GetStatus() == eWasMoveConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayUncopyableValue->GetStatus() == eWasMoveConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayUncopyableValue->GetStatus() == eWasMoveConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 557); do { } while (false); do { MOZ_CrashSequence(__null, 557
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
88
Assuming the condition is true
89
Taking false branch
90
Loop condition is false. Exiting loop
557 eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayUncopyableValue->GetStatus() == eWasMoveConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayUncopyableValue->GetStatus() == eWasMoveConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayUncopyableValue->GetStatus() == eWasMoveConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 557); do { } while (false); do { MOZ_CrashSequence(__null, 557
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
558 mayUncopyableValue = Some(UncopyableValue());
559 MOZ_RELEASE_ASSERT(mayUncopyableValue->GetStatus() == eWasMoveAssigned)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayUncopyableValue->GetStatus() == eWasMoveAssigned
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayUncopyableValue->GetStatus() == eWasMoveAssigned
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayUncopyableValue->GetStatus() == eWasMoveAssigned", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 559); do { } while (false); do { MOZ_CrashSequence(__null, 559
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
91
Assuming the condition is true
92
Taking false branch
93
Loop condition is false. Exiting loop
560 mayUncopyableValue.reset();
561 mayUncopyableValue.emplace(UncopyableValue());
562 MOZ_RELEASE_ASSERT(mayUncopyableValue->GetStatus() ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayUncopyableValue->GetStatus() == eWasMoveConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayUncopyableValue->GetStatus() == eWasMoveConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayUncopyableValue->GetStatus() == eWasMoveConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 563); do { } while (false); do { MOZ_CrashSequence(__null, 563
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
94
Assuming the condition is true
95
Taking false branch
96
Loop condition is false. Exiting loop
563 eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayUncopyableValue->GetStatus() == eWasMoveConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayUncopyableValue->GetStatus() == eWasMoveConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayUncopyableValue->GetStatus() == eWasMoveConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 563); do { } while (false); do { MOZ_CrashSequence(__null, 563
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
564 mayUncopyableValue = Nothing();
565 }
566
567 TestMoveMaybe<BasicValue>();
568
569 static_assert(!std::is_copy_constructible_v<Maybe<UncopyableValue>>);
570 static_assert(!std::is_copy_assignable_v<Maybe<UncopyableValue>>);
571 static_assert(std::is_move_constructible_v<Maybe<UncopyableValue>>);
572 static_assert(std::is_move_assignable_v<Maybe<UncopyableValue>>);
573 }
574
575 MOZ_RELEASE_ASSERT(0 == sUndestroyedObjects)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(0 == sUndestroyedObjects)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(0 == sUndestroyedObjects))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("0 == sUndestroyedObjects"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 575); do { }
while (false); do { MOZ_CrashSequence(__null, 575); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
97
Assuming 'sUndestroyedObjects' is equal to 0
98
Taking false branch
99
Loop condition is false. Exiting loop
576
577 { // Check that types that support neither moves or copies work.
578 {
579 const auto mayUncopyableUnmovableValueConstructed =
580 Maybe<UncopyableUnmovableValue>{std::in_place};
581 MOZ_RELEASE_ASSERT(mayUncopyableUnmovableValueConstructed->GetStatus() ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayUncopyableUnmovableValueConstructed->GetStatus
() == eWasDefaultConstructed)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayUncopyableUnmovableValueConstructed
->GetStatus() == eWasDefaultConstructed))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("mayUncopyableUnmovableValueConstructed->GetStatus() == eWasDefaultConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 582); do { }
while (false); do { MOZ_CrashSequence(__null, 582); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
100
Assuming the condition is true
101
Taking false branch
102
Loop condition is false. Exiting loop
582 eWasDefaultConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayUncopyableUnmovableValueConstructed->GetStatus
() == eWasDefaultConstructed)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayUncopyableUnmovableValueConstructed
->GetStatus() == eWasDefaultConstructed))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("mayUncopyableUnmovableValueConstructed->GetStatus() == eWasDefaultConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 582); do { }
while (false); do { MOZ_CrashSequence(__null, 582); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
583 }
584
585 Maybe<UncopyableUnmovableValue> mayUncopyableUnmovableValue;
586 mayUncopyableUnmovableValue.emplace();
587 MOZ_RELEASE_ASSERT(mayUncopyableUnmovableValue->GetStatus() ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayUncopyableUnmovableValue->GetStatus() == eWasDefaultConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayUncopyableUnmovableValue->GetStatus() == eWasDefaultConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayUncopyableUnmovableValue->GetStatus() == eWasDefaultConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 588); do { }
while (false); do { MOZ_CrashSequence(__null, 588); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
103
Assuming the condition is true
104
Taking false branch
105
Loop condition is false. Exiting loop
588 eWasDefaultConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayUncopyableUnmovableValue->GetStatus() == eWasDefaultConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayUncopyableUnmovableValue->GetStatus() == eWasDefaultConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayUncopyableUnmovableValue->GetStatus() == eWasDefaultConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 588); do { }
while (false); do { MOZ_CrashSequence(__null, 588); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
589 mayUncopyableUnmovableValue.reset();
590 mayUncopyableUnmovableValue.emplace(0);
591 MOZ_RELEASE_ASSERT(mayUncopyableUnmovableValue->GetStatus() ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayUncopyableUnmovableValue->GetStatus() == eWasConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayUncopyableUnmovableValue->GetStatus() == eWasConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayUncopyableUnmovableValue->GetStatus() == eWasConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 592); do { }
while (false); do { MOZ_CrashSequence(__null, 592); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
106
Assuming the condition is true
107
Taking false branch
108
Loop condition is false. Exiting loop
592 eWasConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayUncopyableUnmovableValue->GetStatus() == eWasConstructed
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayUncopyableUnmovableValue->GetStatus() == eWasConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"mayUncopyableUnmovableValue->GetStatus() == eWasConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 592); do { }
while (false); do { MOZ_CrashSequence(__null, 592); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
593 mayUncopyableUnmovableValue = Nothing();
594
595 static_assert(
596 !std::is_copy_constructible_v<Maybe<UncopyableUnmovableValue>>);
597 static_assert(!std::is_copy_assignable_v<Maybe<UncopyableUnmovableValue>>);
598 static_assert(
599 !std::is_move_constructible_v<Maybe<UncopyableUnmovableValue>>);
600 static_assert(!std::is_move_assignable_v<Maybe<UncopyableUnmovableValue>>);
601 }
602
603 {
604 // Test copy and move with a trivially copyable and trivially destructible
605 // type.
606 {
607 constexpr Maybe<int> src = Some(42);
608 constexpr Maybe<int> dstCopyConstructed = src;
609
610 static_assert(src.isSome());
611 static_assert(dstCopyConstructed.isSome());
612 static_assert(42 == *src);
613 static_assert(42 == *dstCopyConstructed);
614 static_assert(42 == dstCopyConstructed.value());
615 }
616
617 {
618 const Maybe<int> src = Some(42);
619 Maybe<int> dstCopyAssigned;
620 dstCopyAssigned = src;
621
622 MOZ_RELEASE_ASSERT(src.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(src.isSome()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("src.isSome()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 622); do { } while (false); do { MOZ_CrashSequence(__null, 622
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
109
Assuming the condition is false
110
Taking false branch
111
Loop condition is false. Exiting loop
623 MOZ_RELEASE_ASSERT(dstCopyAssigned.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dstCopyAssigned.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dstCopyAssigned.isSome()))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("dstCopyAssigned.isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 623); do { }
while (false); do { MOZ_CrashSequence(__null, 623); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
112
Assuming the condition is false
113
Taking false branch
114
Loop condition is false. Exiting loop
624 MOZ_RELEASE_ASSERT(42 == *src)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(42 == *src)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(42 == *src))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("42 == *src", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 624); do { } while (false); do { MOZ_CrashSequence(__null, 624
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
115
Assuming the condition is true
116
Taking false branch
117
Loop condition is false. Exiting loop
625 MOZ_RELEASE_ASSERT(42 == *dstCopyAssigned)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(42 == *dstCopyAssigned)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(42 == *dstCopyAssigned))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("42 == *dstCopyAssigned"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 625); do { }
while (false); do { MOZ_CrashSequence(__null, 625); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
118
Assuming the condition is true
119
Taking false branch
120
Loop condition is false. Exiting loop
626 }
627
628 {
629 Maybe<int> src = Some(42);
630 const Maybe<int> dstMoveConstructed = std::move(src);
631
632 MOZ_RELEASE_ASSERT(!src.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!src.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!src.isSome()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("!src.isSome()",
"/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 632); do { }
while (false); do { MOZ_CrashSequence(__null, 632); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
121
Assuming the condition is true
122
Taking false branch
123
Loop condition is false. Exiting loop
633 MOZ_RELEASE_ASSERT(dstMoveConstructed.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dstMoveConstructed.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dstMoveConstructed.isSome())
)), 0))) { do { } while (false); MOZ_ReportAssertionFailure("dstMoveConstructed.isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 633); do { }
while (false); do { MOZ_CrashSequence(__null, 633); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
124
Assuming the condition is false
125
Taking false branch
126
Loop condition is false. Exiting loop
634 MOZ_RELEASE_ASSERT(42 == *dstMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(42 == *dstMoveConstructed)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(42 == *dstMoveConstructed)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("42 == *dstMoveConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 634); do { }
while (false); do { MOZ_CrashSequence(__null, 634); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
127
Assuming the condition is true
128
Taking false branch
129
Loop condition is false. Exiting loop
635 }
636
637 {
638 Maybe<int> src = Some(42);
639 Maybe<int> dstMoveAssigned;
640 dstMoveAssigned = std::move(src);
130
Object 'src' is moved
641
642 MOZ_RELEASE_ASSERT(!src.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!src.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!src.isSome()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("!src.isSome()",
"/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 642); do { }
while (false); do { MOZ_CrashSequence(__null, 642); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
131
Method called on moved-from object 'src'
643 MOZ_RELEASE_ASSERT(dstMoveAssigned.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dstMoveAssigned.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dstMoveAssigned.isSome()))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("dstMoveAssigned.isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 643); do { }
while (false); do { MOZ_CrashSequence(__null, 643); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
644 MOZ_RELEASE_ASSERT(42 == *dstMoveAssigned)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(42 == *dstMoveAssigned)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(42 == *dstMoveAssigned))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("42 == *dstMoveAssigned"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 644); do { }
while (false); do { MOZ_CrashSequence(__null, 644); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
645 }
646 }
647
648 return true;
649}
650
651static BasicValue* sStaticBasicValue = nullptr;
652
653static BasicValue MakeBasicValue() { return BasicValue(9); }
654
655static BasicValue& MakeBasicValueRef() { return *sStaticBasicValue; }
656
657static BasicValue* MakeBasicValuePtr() { return sStaticBasicValue; }
658
659static bool TestFunctionalAccessors() {
660 BasicValue value(9);
661 sStaticBasicValue = new BasicValue(9);
662
663 // Check that the 'some' case of functional accessors works.
664 Maybe<BasicValue> someValue = Some(BasicValue(3));
665 MOZ_RELEASE_ASSERT(someValue.valueOr(value) == BasicValue(3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(someValue.valueOr(value) == BasicValue(3))>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(someValue.valueOr(value) == BasicValue(3)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("someValue.valueOr(value) == BasicValue(3)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 665); do { }
while (false); do { MOZ_CrashSequence(__null, 665); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
666 static_assert(std::is_same_v<BasicValue, decltype(someValue.valueOr(value))>,
667 "valueOr should return a BasicValue");
668 MOZ_RELEASE_ASSERT(someValue.valueOrFrom(&MakeBasicValue) == BasicValue(3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(someValue.valueOrFrom(&MakeBasicValue) == BasicValue
(3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(someValue.valueOrFrom(&MakeBasicValue) == BasicValue
(3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("someValue.valueOrFrom(&MakeBasicValue) == BasicValue(3)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 668); do { }
while (false); do { MOZ_CrashSequence(__null, 668); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
669 static_assert(
670 std::is_same_v<BasicValue,
671 decltype(someValue.valueOrFrom(&MakeBasicValue))>,
672 "valueOrFrom should return a BasicValue");
673 MOZ_RELEASE_ASSERT(someValue.ptrOr(&value) != &value)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(someValue.ptrOr(&value) != &value)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(someValue.ptrOr(&value) != &value))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("someValue.ptrOr(&value) != &value"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 673); do { }
while (false); do { MOZ_CrashSequence(__null, 673); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
674 static_assert(std::is_same_v<BasicValue*, decltype(someValue.ptrOr(&value))>,
675 "ptrOr should return a BasicValue*");
676 MOZ_RELEASE_ASSERT(*someValue.ptrOrFrom(&MakeBasicValuePtr) == BasicValue(3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*someValue.ptrOrFrom(&MakeBasicValuePtr) == BasicValue
(3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(*someValue.ptrOrFrom(&MakeBasicValuePtr) == BasicValue
(3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("*someValue.ptrOrFrom(&MakeBasicValuePtr) == BasicValue(3)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 676); do { }
while (false); do { MOZ_CrashSequence(__null, 676); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
677 static_assert(
678 std::is_same_v<BasicValue*,
679 decltype(someValue.ptrOrFrom(&MakeBasicValuePtr))>,
680 "ptrOrFrom should return a BasicValue*");
681 MOZ_RELEASE_ASSERT(someValue.refOr(value) == BasicValue(3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(someValue.refOr(value) == BasicValue(3))>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(someValue.refOr(value) == BasicValue(3)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("someValue.refOr(value) == BasicValue(3)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 681); do { }
while (false); do { MOZ_CrashSequence(__null, 681); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
682 static_assert(std::is_same_v<BasicValue&, decltype(someValue.refOr(value))>,
683 "refOr should return a BasicValue&");
684 MOZ_RELEASE_ASSERT(someValue.refOrFrom(&MakeBasicValueRef) == BasicValue(3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(someValue.refOrFrom(&MakeBasicValueRef) == BasicValue
(3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(someValue.refOrFrom(&MakeBasicValueRef) == BasicValue
(3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("someValue.refOrFrom(&MakeBasicValueRef) == BasicValue(3)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 684); do { }
while (false); do { MOZ_CrashSequence(__null, 684); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
685 static_assert(
686 std::is_same_v<BasicValue&,
687 decltype(someValue.refOrFrom(&MakeBasicValueRef))>,
688 "refOrFrom should return a BasicValue&");
689
690 // Check that the 'some' case works through a const reference.
691 const Maybe<BasicValue>& someValueCRef = someValue;
692 MOZ_RELEASE_ASSERT(someValueCRef.valueOr(value) == BasicValue(3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(someValueCRef.valueOr(value) == BasicValue(3))>::
isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(someValueCRef.valueOr(value) == BasicValue(3)))), 0)
)) { do { } while (false); MOZ_ReportAssertionFailure("someValueCRef.valueOr(value) == BasicValue(3)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 692); do { }
while (false); do { MOZ_CrashSequence(__null, 692); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
693 static_assert(
694 std::is_same_v<BasicValue, decltype(someValueCRef.valueOr(value))>,
695 "valueOr should return a BasicValue");
696 MOZ_RELEASE_ASSERT(someValueCRef.valueOrFrom(&MakeBasicValue) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(someValueCRef.valueOrFrom(&MakeBasicValue) == BasicValue
(3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(someValueCRef.valueOrFrom(&MakeBasicValue) == BasicValue
(3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("someValueCRef.valueOrFrom(&MakeBasicValue) == BasicValue(3)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 697); do { }
while (false); do { MOZ_CrashSequence(__null, 697); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
697 BasicValue(3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(someValueCRef.valueOrFrom(&MakeBasicValue) == BasicValue
(3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(someValueCRef.valueOrFrom(&MakeBasicValue) == BasicValue
(3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("someValueCRef.valueOrFrom(&MakeBasicValue) == BasicValue(3)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 697); do { }
while (false); do { MOZ_CrashSequence(__null, 697); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
698 static_assert(
699 std::is_same_v<BasicValue,
700 decltype(someValueCRef.valueOrFrom(&MakeBasicValue))>,
701 "valueOrFrom should return a BasicValue");
702 MOZ_RELEASE_ASSERT(someValueCRef.ptrOr(&value) != &value)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(someValueCRef.ptrOr(&value) != &value)>::
isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(someValueCRef.ptrOr(&value) != &value))), 0)
)) { do { } while (false); MOZ_ReportAssertionFailure("someValueCRef.ptrOr(&value) != &value"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 702); do { }
while (false); do { MOZ_CrashSequence(__null, 702); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
703 static_assert(
704 std::is_same_v<const BasicValue*, decltype(someValueCRef.ptrOr(&value))>,
705 "ptrOr should return a const BasicValue*");
706 MOZ_RELEASE_ASSERT(*someValueCRef.ptrOrFrom(&MakeBasicValuePtr) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*someValueCRef.ptrOrFrom(&MakeBasicValuePtr) == BasicValue
(3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(*someValueCRef.ptrOrFrom(&MakeBasicValuePtr) == BasicValue
(3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("*someValueCRef.ptrOrFrom(&MakeBasicValuePtr) == BasicValue(3)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 707); do { }
while (false); do { MOZ_CrashSequence(__null, 707); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
707 BasicValue(3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*someValueCRef.ptrOrFrom(&MakeBasicValuePtr) == BasicValue
(3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(*someValueCRef.ptrOrFrom(&MakeBasicValuePtr) == BasicValue
(3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("*someValueCRef.ptrOrFrom(&MakeBasicValuePtr) == BasicValue(3)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 707); do { }
while (false); do { MOZ_CrashSequence(__null, 707); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
708 static_assert(
709 std::is_same_v<const BasicValue*,
710 decltype(someValueCRef.ptrOrFrom(&MakeBasicValuePtr))>,
711 "ptrOrFrom should return a const BasicValue*");
712 MOZ_RELEASE_ASSERT(someValueCRef.refOr(value) == BasicValue(3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(someValueCRef.refOr(value) == BasicValue(3))>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(someValueCRef.refOr(value) == BasicValue(3)))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("someValueCRef.refOr(value) == BasicValue(3)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 712); do { }
while (false); do { MOZ_CrashSequence(__null, 712); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
713 static_assert(
714 std::is_same_v<const BasicValue&, decltype(someValueCRef.refOr(value))>,
715 "refOr should return a const BasicValue&");
716 MOZ_RELEASE_ASSERT(someValueCRef.refOrFrom(&MakeBasicValueRef) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(someValueCRef.refOrFrom(&MakeBasicValueRef) == BasicValue
(3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(someValueCRef.refOrFrom(&MakeBasicValueRef) == BasicValue
(3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("someValueCRef.refOrFrom(&MakeBasicValueRef) == BasicValue(3)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 717); do { }
while (false); do { MOZ_CrashSequence(__null, 717); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
717 BasicValue(3))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(someValueCRef.refOrFrom(&MakeBasicValueRef) == BasicValue
(3))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(someValueCRef.refOrFrom(&MakeBasicValueRef) == BasicValue
(3)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("someValueCRef.refOrFrom(&MakeBasicValueRef) == BasicValue(3)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 717); do { }
while (false); do { MOZ_CrashSequence(__null, 717); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
718 static_assert(
719 std::is_same_v<const BasicValue&,
720 decltype(someValueCRef.refOrFrom(&MakeBasicValueRef))>,
721 "refOrFrom should return a const BasicValue&");
722
723 // Check that the 'none' case of functional accessors works.
724 Maybe<BasicValue> noneValue;
725 MOZ_RELEASE_ASSERT(noneValue.valueOr(value) == BasicValue(9))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(noneValue.valueOr(value) == BasicValue(9))>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(noneValue.valueOr(value) == BasicValue(9)))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("noneValue.valueOr(value) == BasicValue(9)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 725); do { }
while (false); do { MOZ_CrashSequence(__null, 725); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
726 static_assert(std::is_same_v<BasicValue, decltype(noneValue.valueOr(value))>,
727 "valueOr should return a BasicValue");
728 MOZ_RELEASE_ASSERT(noneValue.valueOrFrom(&MakeBasicValue) == BasicValue(9))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(noneValue.valueOrFrom(&MakeBasicValue) == BasicValue
(9))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(noneValue.valueOrFrom(&MakeBasicValue) == BasicValue
(9)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("noneValue.valueOrFrom(&MakeBasicValue) == BasicValue(9)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 728); do { }
while (false); do { MOZ_CrashSequence(__null, 728); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
729 static_assert(
730 std::is_same_v<BasicValue,
731 decltype(noneValue.valueOrFrom(&MakeBasicValue))>,
732 "valueOrFrom should return a BasicValue");
733 MOZ_RELEASE_ASSERT(noneValue.ptrOr(&value) == &value)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(noneValue.ptrOr(&value) == &value)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(noneValue.ptrOr(&value) == &value))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("noneValue.ptrOr(&value) == &value"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 733); do { }
while (false); do { MOZ_CrashSequence(__null, 733); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
734 static_assert(std::is_same_v<BasicValue*, decltype(noneValue.ptrOr(&value))>,
735 "ptrOr should return a BasicValue*");
736 MOZ_RELEASE_ASSERT(*noneValue.ptrOrFrom(&MakeBasicValuePtr) == BasicValue(9))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*noneValue.ptrOrFrom(&MakeBasicValuePtr) == BasicValue
(9))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(*noneValue.ptrOrFrom(&MakeBasicValuePtr) == BasicValue
(9)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("*noneValue.ptrOrFrom(&MakeBasicValuePtr) == BasicValue(9)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 736); do { }
while (false); do { MOZ_CrashSequence(__null, 736); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
737 static_assert(
738 std::is_same_v<BasicValue*,
739 decltype(noneValue.ptrOrFrom(&MakeBasicValuePtr))>,
740 "ptrOrFrom should return a BasicValue*");
741 MOZ_RELEASE_ASSERT(noneValue.refOr(value) == BasicValue(9))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(noneValue.refOr(value) == BasicValue(9))>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(noneValue.refOr(value) == BasicValue(9)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("noneValue.refOr(value) == BasicValue(9)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 741); do { }
while (false); do { MOZ_CrashSequence(__null, 741); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
742 static_assert(std::is_same_v<BasicValue&, decltype(noneValue.refOr(value))>,
743 "refOr should return a BasicValue&");
744 MOZ_RELEASE_ASSERT(noneValue.refOrFrom(&MakeBasicValueRef) == BasicValue(9))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(noneValue.refOrFrom(&MakeBasicValueRef) == BasicValue
(9))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(noneValue.refOrFrom(&MakeBasicValueRef) == BasicValue
(9)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("noneValue.refOrFrom(&MakeBasicValueRef) == BasicValue(9)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 744); do { }
while (false); do { MOZ_CrashSequence(__null, 744); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
745 static_assert(
746 std::is_same_v<BasicValue&,
747 decltype(noneValue.refOrFrom(&MakeBasicValueRef))>,
748 "refOrFrom should return a BasicValue&");
749
750 // Check that the 'none' case works through a const reference.
751 const Maybe<BasicValue>& noneValueCRef = noneValue;
752 MOZ_RELEASE_ASSERT(noneValueCRef.valueOr(value) == BasicValue(9))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(noneValueCRef.valueOr(value) == BasicValue(9))>::
isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(noneValueCRef.valueOr(value) == BasicValue(9)))), 0)
)) { do { } while (false); MOZ_ReportAssertionFailure("noneValueCRef.valueOr(value) == BasicValue(9)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 752); do { }
while (false); do { MOZ_CrashSequence(__null, 752); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
753 static_assert(
754 std::is_same_v<BasicValue, decltype(noneValueCRef.valueOr(value))>,
755 "valueOr should return a BasicValue");
756 MOZ_RELEASE_ASSERT(noneValueCRef.valueOrFrom(&MakeBasicValue) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(noneValueCRef.valueOrFrom(&MakeBasicValue) == BasicValue
(9))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(noneValueCRef.valueOrFrom(&MakeBasicValue) == BasicValue
(9)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("noneValueCRef.valueOrFrom(&MakeBasicValue) == BasicValue(9)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 757); do { }
while (false); do { MOZ_CrashSequence(__null, 757); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
757 BasicValue(9))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(noneValueCRef.valueOrFrom(&MakeBasicValue) == BasicValue
(9))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(noneValueCRef.valueOrFrom(&MakeBasicValue) == BasicValue
(9)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("noneValueCRef.valueOrFrom(&MakeBasicValue) == BasicValue(9)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 757); do { }
while (false); do { MOZ_CrashSequence(__null, 757); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
758 static_assert(
759 std::is_same_v<BasicValue,
760 decltype(noneValueCRef.valueOrFrom(&MakeBasicValue))>,
761 "valueOrFrom should return a BasicValue");
762 MOZ_RELEASE_ASSERT(noneValueCRef.ptrOr(&value) == &value)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(noneValueCRef.ptrOr(&value) == &value)>::
isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(noneValueCRef.ptrOr(&value) == &value))), 0)
)) { do { } while (false); MOZ_ReportAssertionFailure("noneValueCRef.ptrOr(&value) == &value"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 762); do { }
while (false); do { MOZ_CrashSequence(__null, 762); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
763 static_assert(
764 std::is_same_v<const BasicValue*, decltype(noneValueCRef.ptrOr(&value))>,
765 "ptrOr should return a const BasicValue*");
766 MOZ_RELEASE_ASSERT(*noneValueCRef.ptrOrFrom(&MakeBasicValuePtr) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*noneValueCRef.ptrOrFrom(&MakeBasicValuePtr) == BasicValue
(9))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(*noneValueCRef.ptrOrFrom(&MakeBasicValuePtr) == BasicValue
(9)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("*noneValueCRef.ptrOrFrom(&MakeBasicValuePtr) == BasicValue(9)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 767); do { }
while (false); do { MOZ_CrashSequence(__null, 767); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
767 BasicValue(9))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*noneValueCRef.ptrOrFrom(&MakeBasicValuePtr) == BasicValue
(9))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(*noneValueCRef.ptrOrFrom(&MakeBasicValuePtr) == BasicValue
(9)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("*noneValueCRef.ptrOrFrom(&MakeBasicValuePtr) == BasicValue(9)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 767); do { }
while (false); do { MOZ_CrashSequence(__null, 767); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
768 static_assert(
769 std::is_same_v<const BasicValue*,
770 decltype(noneValueCRef.ptrOrFrom(&MakeBasicValuePtr))>,
771 "ptrOrFrom should return a const BasicValue*");
772 MOZ_RELEASE_ASSERT(noneValueCRef.refOr(value) == BasicValue(9))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(noneValueCRef.refOr(value) == BasicValue(9))>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(noneValueCRef.refOr(value) == BasicValue(9)))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("noneValueCRef.refOr(value) == BasicValue(9)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 772); do { }
while (false); do { MOZ_CrashSequence(__null, 772); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
773 static_assert(
774 std::is_same_v<const BasicValue&, decltype(noneValueCRef.refOr(value))>,
775 "refOr should return a const BasicValue&");
776 MOZ_RELEASE_ASSERT(noneValueCRef.refOrFrom(&MakeBasicValueRef) ==do { static_assert( mozilla::detail::AssertionConditionType<
decltype(noneValueCRef.refOrFrom(&MakeBasicValueRef) == BasicValue
(9))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(noneValueCRef.refOrFrom(&MakeBasicValueRef) == BasicValue
(9)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("noneValueCRef.refOrFrom(&MakeBasicValueRef) == BasicValue(9)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 777); do { }
while (false); do { MOZ_CrashSequence(__null, 777); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
777 BasicValue(9))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(noneValueCRef.refOrFrom(&MakeBasicValueRef) == BasicValue
(9))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(noneValueCRef.refOrFrom(&MakeBasicValueRef) == BasicValue
(9)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("noneValueCRef.refOrFrom(&MakeBasicValueRef) == BasicValue(9)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 777); do { }
while (false); do { MOZ_CrashSequence(__null, 777); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
778 static_assert(
779 std::is_same_v<const BasicValue&,
780 decltype(noneValueCRef.refOrFrom(&MakeBasicValueRef))>,
781 "refOrFrom should return a const BasicValue&");
782
783 // Clean up so the undestroyed objects count stays accurate.
784 delete sStaticBasicValue;
785 sStaticBasicValue = nullptr;
786
787 return true;
788}
789
790static bool gFunctionWasApplied = false;
791
792static void IncrementTag(BasicValue& aValue) {
793 gFunctionWasApplied = true;
794 aValue.SetTag(aValue.GetTag() + 1);
795}
796
797static void AccessValue(const BasicValue&) { gFunctionWasApplied = true; }
798
799struct IncrementTagFunctor {
800 IncrementTagFunctor() : mBy(1) {}
801
802 void operator()(BasicValue& aValue) {
803 aValue.SetTag(aValue.GetTag() + mBy.GetTag());
804 }
805
806 BasicValue mBy;
807};
808
809static bool TestApply() {
810 // Check that apply handles the 'Nothing' case.
811 gFunctionWasApplied = false;
812 Maybe<BasicValue> mayValue;
813 mayValue.apply(&IncrementTag);
814 mayValue.apply(&AccessValue);
815 MOZ_RELEASE_ASSERT(!gFunctionWasApplied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!gFunctionWasApplied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!gFunctionWasApplied))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("!gFunctionWasApplied"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 815); do { }
while (false); do { MOZ_CrashSequence(__null, 815); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
816
817 // Check that apply handles the 'Some' case.
818 mayValue = Some(BasicValue(1));
819 mayValue.apply(&IncrementTag);
820 MOZ_RELEASE_ASSERT(gFunctionWasApplied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(gFunctionWasApplied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(gFunctionWasApplied))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("gFunctionWasApplied"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 820); do { }
while (false); do { MOZ_CrashSequence(__null, 820); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
821 MOZ_RELEASE_ASSERT(mayValue->GetTag() == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue->GetTag() == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue->GetTag() == 2))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("mayValue->GetTag() == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 821); do { }
while (false); do { MOZ_CrashSequence(__null, 821); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
822 gFunctionWasApplied = false;
823 mayValue.apply(&AccessValue);
824 MOZ_RELEASE_ASSERT(gFunctionWasApplied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(gFunctionWasApplied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(gFunctionWasApplied))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("gFunctionWasApplied"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 824); do { }
while (false); do { MOZ_CrashSequence(__null, 824); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
825
826 // Check that apply works with a const reference.
827 const Maybe<BasicValue>& mayValueCRef = mayValue;
828 gFunctionWasApplied = false;
829 mayValueCRef.apply(&AccessValue);
830 MOZ_RELEASE_ASSERT(gFunctionWasApplied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(gFunctionWasApplied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(gFunctionWasApplied))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("gFunctionWasApplied"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 830); do { }
while (false); do { MOZ_CrashSequence(__null, 830); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
831
832 // Check that apply works with functors.
833 IncrementTagFunctor tagIncrementer;
834 MOZ_RELEASE_ASSERT(tagIncrementer.mBy.GetStatus() == eWasConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(tagIncrementer.mBy.GetStatus() == eWasConstructed)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(tagIncrementer.mBy.GetStatus() == eWasConstructed)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("tagIncrementer.mBy.GetStatus() == eWasConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 834); do { }
while (false); do { MOZ_CrashSequence(__null, 834); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
835 mayValue = Some(BasicValue(1));
836 mayValue.apply(tagIncrementer);
837 MOZ_RELEASE_ASSERT(mayValue->GetTag() == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue->GetTag() == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue->GetTag() == 2))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("mayValue->GetTag() == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 837); do { }
while (false); do { MOZ_CrashSequence(__null, 837); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
838 MOZ_RELEASE_ASSERT(tagIncrementer.mBy.GetStatus() == eWasConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(tagIncrementer.mBy.GetStatus() == eWasConstructed)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(tagIncrementer.mBy.GetStatus() == eWasConstructed)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("tagIncrementer.mBy.GetStatus() == eWasConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 838); do { }
while (false); do { MOZ_CrashSequence(__null, 838); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
839
840 // Check that apply works with lambda expressions.
841 int32_t two = 2;
842 gFunctionWasApplied = false;
843 mayValue = Some(BasicValue(2));
844 mayValue.apply([&](BasicValue& aVal) { aVal.SetTag(aVal.GetTag() * two); });
845 MOZ_RELEASE_ASSERT(mayValue->GetTag() == 4)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue->GetTag() == 4)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue->GetTag() == 4))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("mayValue->GetTag() == 4"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 845); do { }
while (false); do { MOZ_CrashSequence(__null, 845); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
846 mayValue.apply([=](BasicValue& aVal) { aVal.SetTag(aVal.GetTag() * two); });
847 MOZ_RELEASE_ASSERT(mayValue->GetTag() == 8)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue->GetTag() == 8)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue->GetTag() == 8))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("mayValue->GetTag() == 8"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 847); do { }
while (false); do { MOZ_CrashSequence(__null, 847); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
848 mayValueCRef.apply(
849 [&](const BasicValue& aVal) { gFunctionWasApplied = true; });
850 MOZ_RELEASE_ASSERT(gFunctionWasApplied == true)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(gFunctionWasApplied == true)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(gFunctionWasApplied == true)
)), 0))) { do { } while (false); MOZ_ReportAssertionFailure("gFunctionWasApplied == true"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 850); do { }
while (false); do { MOZ_CrashSequence(__null, 850); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
851
852 // Check that apply can move the contained value.
853 mayValue = Some(BasicValue(1));
854 Maybe<BasicValue> otherValue;
855 std::move(mayValue).apply(
856 [&](BasicValue&& aVal) { otherValue = Some(std::move(aVal)); });
857 MOZ_RELEASE_ASSERT(mayValue.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue.isNothing()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("mayValue.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 857); do { }
while (false); do { MOZ_CrashSequence(__null, 857); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
858 MOZ_RELEASE_ASSERT(otherValue->GetTag() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(otherValue->GetTag() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(otherValue->GetTag() == 1
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"otherValue->GetTag() == 1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 858); do { } while (false); do { MOZ_CrashSequence(__null, 858
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
859 MOZ_RELEASE_ASSERT(otherValue->GetStatus() == eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(otherValue->GetStatus() == eWasMoveConstructed)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(otherValue->GetStatus() == eWasMoveConstructed)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("otherValue->GetStatus() == eWasMoveConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 859); do { }
while (false); do { MOZ_CrashSequence(__null, 859); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
860
861 return true;
862}
863
864static int TimesTwo(const BasicValue& aValue) { return aValue.GetTag() * 2; }
865
866static int TimesTwoAndResetOriginal(BasicValue& aValue) {
867 int tag = aValue.GetTag();
868 aValue.SetTag(1);
869 return tag * 2;
870}
871
872struct MultiplyTagFunctor {
873 MultiplyTagFunctor() : mBy(2) {}
874
875 int operator()(BasicValue& aValue) { return aValue.GetTag() * mBy.GetTag(); }
876
877 BasicValue mBy;
878};
879
880static bool TestMap() {
881 // Check that map handles the 'Nothing' case.
882 Maybe<BasicValue> mayValue;
883 MOZ_RELEASE_ASSERT(mayValue.map(&TimesTwo) == Nothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.map(&TimesTwo) == Nothing())>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(mayValue.map(&TimesTwo) == Nothing()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("mayValue.map(&TimesTwo) == Nothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 883); do { }
while (false); do { MOZ_CrashSequence(__null, 883); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
884 static_assert(std::is_same_v<Maybe<int>, decltype(mayValue.map(&TimesTwo))>,
885 "map(TimesTwo) should return a Maybe<int>");
886 MOZ_RELEASE_ASSERT(mayValue.map(&TimesTwoAndResetOriginal) == Nothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.map(&TimesTwoAndResetOriginal) == Nothing
())>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayValue.map(&TimesTwoAndResetOriginal) == Nothing
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("mayValue.map(&TimesTwoAndResetOriginal) == Nothing()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 886); do { } while (false); do { MOZ_CrashSequence(__null, 886
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
887
888 // Check that map handles the 'Some' case.
889 mayValue = Some(BasicValue(2));
890 MOZ_RELEASE_ASSERT(mayValue.map(&TimesTwo) == Some(4))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.map(&TimesTwo) == Some(4))>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(mayValue.map(&TimesTwo) == Some(4)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("mayValue.map(&TimesTwo) == Some(4)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 890); do { }
while (false); do { MOZ_CrashSequence(__null, 890); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
891 MOZ_RELEASE_ASSERT(mayValue.map(&TimesTwoAndResetOriginal) == Some(4))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.map(&TimesTwoAndResetOriginal) == Some(
4))>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayValue.map(&TimesTwoAndResetOriginal) == Some(
4)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("mayValue.map(&TimesTwoAndResetOriginal) == Some(4)", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 891); do { } while (false); do { MOZ_CrashSequence(__null, 891
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
892 MOZ_RELEASE_ASSERT(mayValue->GetTag() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue->GetTag() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue->GetTag() == 1))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("mayValue->GetTag() == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 892); do { }
while (false); do { MOZ_CrashSequence(__null, 892); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
893 mayValue = Some(BasicValue(2));
894
895 // Check that map works with a const reference.
896 mayValue->SetTag(2);
897 const Maybe<BasicValue>& mayValueCRef = mayValue;
898 MOZ_RELEASE_ASSERT(mayValueCRef.map(&TimesTwo) == Some(4))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValueCRef.map(&TimesTwo) == Some(4))>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(mayValueCRef.map(&TimesTwo) == Some(4)))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("mayValueCRef.map(&TimesTwo) == Some(4)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 898); do { }
while (false); do { MOZ_CrashSequence(__null, 898); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
899 static_assert(
900 std::is_same_v<Maybe<int>, decltype(mayValueCRef.map(&TimesTwo))>,
901 "map(TimesTwo) should return a Maybe<int>");
902
903 // Check that map works with functors.
904 MultiplyTagFunctor tagMultiplier;
905 MOZ_RELEASE_ASSERT(tagMultiplier.mBy.GetStatus() == eWasConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(tagMultiplier.mBy.GetStatus() == eWasConstructed)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(tagMultiplier.mBy.GetStatus() == eWasConstructed))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("tagMultiplier.mBy.GetStatus() == eWasConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 905); do { }
while (false); do { MOZ_CrashSequence(__null, 905); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
906 MOZ_RELEASE_ASSERT(mayValue.map(tagMultiplier) == Some(4))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.map(tagMultiplier) == Some(4))>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(mayValue.map(tagMultiplier) == Some(4)))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("mayValue.map(tagMultiplier) == Some(4)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 906); do { }
while (false); do { MOZ_CrashSequence(__null, 906); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
907 MOZ_RELEASE_ASSERT(tagMultiplier.mBy.GetStatus() == eWasConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(tagMultiplier.mBy.GetStatus() == eWasConstructed)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(tagMultiplier.mBy.GetStatus() == eWasConstructed))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("tagMultiplier.mBy.GetStatus() == eWasConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 907); do { }
while (false); do { MOZ_CrashSequence(__null, 907); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
908
909 // Check that map works with lambda expressions.
910 int two = 2;
911 mayValue = Some(BasicValue(2));
912 Maybe<int> mappedValue =
913 mayValue.map([&](const BasicValue& aVal) { return aVal.GetTag() * two; });
914 MOZ_RELEASE_ASSERT(mappedValue == Some(4))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mappedValue == Some(4))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mappedValue == Some(4)))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("mappedValue == Some(4)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 914); do { }
while (false); do { MOZ_CrashSequence(__null, 914); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
915 mappedValue =
916 mayValue.map([=](const BasicValue& aVal) { return aVal.GetTag() * two; });
917 MOZ_RELEASE_ASSERT(mappedValue == Some(4))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mappedValue == Some(4))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mappedValue == Some(4)))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("mappedValue == Some(4)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 917); do { }
while (false); do { MOZ_CrashSequence(__null, 917); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
918 mappedValue = mayValueCRef.map(
919 [&](const BasicValue& aVal) { return aVal.GetTag() * two; });
920 MOZ_RELEASE_ASSERT(mappedValue == Some(4))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mappedValue == Some(4))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mappedValue == Some(4)))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("mappedValue == Some(4)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 920); do { }
while (false); do { MOZ_CrashSequence(__null, 920); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
921
922 // Check that map can move the contained value.
923 mayValue = Some(BasicValue(1));
924 Maybe<BasicValue> otherValue = std::move(mayValue).map(
925 [](BasicValue&& aValue) { return std::move(aValue); });
926 MOZ_RELEASE_ASSERT(mayValue.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue.isNothing()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("mayValue.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 926); do { }
while (false); do { MOZ_CrashSequence(__null, 926); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
927 MOZ_RELEASE_ASSERT(otherValue->GetTag() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(otherValue->GetTag() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(otherValue->GetTag() == 1
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"otherValue->GetTag() == 1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 927); do { } while (false); do { MOZ_CrashSequence(__null, 927
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
928 MOZ_RELEASE_ASSERT(otherValue->GetStatus() == eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(otherValue->GetStatus() == eWasMoveConstructed)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(otherValue->GetStatus() == eWasMoveConstructed)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("otherValue->GetStatus() == eWasMoveConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 928); do { }
while (false); do { MOZ_CrashSequence(__null, 928); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
929
930 // Check that function object qualifiers are preserved when invoked.
931 struct F {
932 std::integral_constant<int, 1> operator()(int) & { return {}; }
933 std::integral_constant<int, 2> operator()(int) const& { return {}; }
934 std::integral_constant<int, 3> operator()(int) && { return {}; }
935 std::integral_constant<int, 4> operator()(int) const&& { return {}; }
936 };
937 Maybe<int> mi = Some(0);
938 const Maybe<int> cmi = Some(0);
939 F f;
940 static_assert(std::is_same<decltype(mi.map(f)),
941 Maybe<std::integral_constant<int, 1>>>::value,
942 "Maybe.map(&)");
943 MOZ_RELEASE_ASSERT(mi.map(f).value()() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mi.map(f).value()() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mi.map(f).value()() == 1))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("mi.map(f).value()() == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 943); do { }
while (false); do { MOZ_CrashSequence(__null, 943); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
944 static_assert(std::is_same<decltype(cmi.map(f)),
945 Maybe<std::integral_constant<int, 1>>>::value,
946 "const Maybe.map(&)");
947 MOZ_RELEASE_ASSERT(cmi.map(f).value()() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(cmi.map(f).value()() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cmi.map(f).value()() == 1)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("cmi.map(f).value()() == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 947); do { }
while (false); do { MOZ_CrashSequence(__null, 947); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
948 const F cf;
949 static_assert(std::is_same<decltype(mi.map(cf)),
950 Maybe<std::integral_constant<int, 2>>>::value,
951 "Maybe.map(const &)");
952 MOZ_RELEASE_ASSERT(mi.map(cf).value() == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mi.map(cf).value() == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mi.map(cf).value() == 2))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("mi.map(cf).value() == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 952); do { }
while (false); do { MOZ_CrashSequence(__null, 952); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
953 static_assert(std::is_same<decltype(cmi.map(cf)),
954 Maybe<std::integral_constant<int, 2>>>::value,
955 "const Maybe.map(const &)");
956 MOZ_RELEASE_ASSERT(cmi.map(cf).value() == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(cmi.map(cf).value() == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cmi.map(cf).value() == 2))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("cmi.map(cf).value() == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 956); do { }
while (false); do { MOZ_CrashSequence(__null, 956); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
957 static_assert(std::is_same<decltype(mi.map(F{})),
958 Maybe<std::integral_constant<int, 3>>>::value,
959 "Maybe.map(&&)");
960 MOZ_RELEASE_ASSERT(mi.map(F{}).value() == 3)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mi.map(F{}).value() == 3)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mi.map(F{}).value() == 3))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("mi.map(F{}).value() == 3"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 960); do { }
while (false); do { MOZ_CrashSequence(__null, 960); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
961 static_assert(std::is_same<decltype(cmi.map(F{})),
962 Maybe<std::integral_constant<int, 3>>>::value,
963 "const Maybe.map(&&)");
964 MOZ_RELEASE_ASSERT(cmi.map(F{}).value() == 3)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(cmi.map(F{}).value() == 3)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cmi.map(F{}).value() == 3)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("cmi.map(F{}).value() == 3"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 964); do { }
while (false); do { MOZ_CrashSequence(__null, 964); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
965 using CF = const F;
966 static_assert(std::is_same<decltype(mi.map(CF{})),
967 Maybe<std::integral_constant<int, 4>>>::value,
968 "Maybe.map(const &&)");
969 MOZ_RELEASE_ASSERT(mi.map(CF{}).value() == 4)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mi.map(CF{}).value() == 4)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mi.map(CF{}).value() == 4)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("mi.map(CF{}).value() == 4"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 969); do { }
while (false); do { MOZ_CrashSequence(__null, 969); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
970 static_assert(std::is_same<decltype(cmi.map(CF{})),
971 Maybe<std::integral_constant<int, 4>>>::value,
972 "const Maybe.map(const &&)");
973 MOZ_RELEASE_ASSERT(cmi.map(CF{}).value() == 4)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(cmi.map(CF{}).value() == 4)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cmi.map(CF{}).value() == 4))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("cmi.map(CF{}).value() == 4"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 973); do { }
while (false); do { MOZ_CrashSequence(__null, 973); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
974
975 return true;
976}
977
978static bool TestToMaybe() {
979 BasicValue value(1);
980 BasicValue* nullPointer = nullptr;
981
982 // Check that a non-null pointer translates into a Some value.
983 Maybe<BasicValue> mayValue = ToMaybe(&value);
984 static_assert(std::is_same_v<Maybe<BasicValue>, decltype(ToMaybe(&value))>,
985 "ToMaybe should return a Maybe<BasicValue>");
986 MOZ_RELEASE_ASSERT(mayValue.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue.isSome()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("mayValue.isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 986); do { }
while (false); do { MOZ_CrashSequence(__null, 986); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
987 MOZ_RELEASE_ASSERT(mayValue->GetTag() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue->GetTag() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue->GetTag() == 1))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("mayValue->GetTag() == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 987); do { }
while (false); do { MOZ_CrashSequence(__null, 987); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
988 MOZ_RELEASE_ASSERT(mayValue->GetStatus() == eWasCopyConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue->GetStatus() == eWasCopyConstructed)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(mayValue->GetStatus() == eWasCopyConstructed))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("mayValue->GetStatus() == eWasCopyConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 988); do { }
while (false); do { MOZ_CrashSequence(__null, 988); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
989 MOZ_RELEASE_ASSERT(value.GetStatus() != eWasMovedFrom)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(value.GetStatus() != eWasMovedFrom)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(value.GetStatus() != eWasMovedFrom
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"value.GetStatus() != eWasMovedFrom", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 989); do { } while (false); do { MOZ_CrashSequence(__null, 989
); __attribute__((nomerge)) ::abort(); } while (false); } } while
(false)
;
990
991 // Check that a null pointer translates into a Nothing value.
992 mayValue = ToMaybe(nullPointer);
993 static_assert(
994 std::is_same_v<Maybe<BasicValue>, decltype(ToMaybe(nullPointer))>,
995 "ToMaybe should return a Maybe<BasicValue>");
996 MOZ_RELEASE_ASSERT(mayValue.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue.isNothing()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("mayValue.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 996); do { }
while (false); do { MOZ_CrashSequence(__null, 996); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
997
998 return true;
999}
1000
1001static bool TestComparisonOperators() {
1002 Maybe<BasicValue> nothingValue = Nothing();
1003 Maybe<BasicValue> anotherNothingValue = Nothing();
1004 Maybe<BasicValue> oneValue = Some(BasicValue(1));
1005 Maybe<BasicValue> anotherOneValue = Some(BasicValue(1));
1006 Maybe<BasicValue> twoValue = Some(BasicValue(2));
1007
1008 // Check equality.
1009 MOZ_RELEASE_ASSERT(nothingValue == anotherNothingValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(nothingValue == anotherNothingValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(nothingValue == anotherNothingValue
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"nothingValue == anotherNothingValue", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1009); do { } while (false); do { MOZ_CrashSequence(__null,
1009); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1010 MOZ_RELEASE_ASSERT(oneValue == anotherOneValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(oneValue == anotherOneValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(oneValue == anotherOneValue)
)), 0))) { do { } while (false); MOZ_ReportAssertionFailure("oneValue == anotherOneValue"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1010); do {
} while (false); do { MOZ_CrashSequence(__null, 1010); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1011
1012 // Check inequality.
1013 MOZ_RELEASE_ASSERT(nothingValue != oneValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(nothingValue != oneValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(nothingValue != oneValue))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("nothingValue != oneValue"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1013); do {
} while (false); do { MOZ_CrashSequence(__null, 1013); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1014 MOZ_RELEASE_ASSERT(oneValue != nothingValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(oneValue != nothingValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(oneValue != nothingValue))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("oneValue != nothingValue"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1014); do {
} while (false); do { MOZ_CrashSequence(__null, 1014); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1015 MOZ_RELEASE_ASSERT(oneValue != twoValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(oneValue != twoValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(oneValue != twoValue))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("oneValue != twoValue"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1015); do {
} while (false); do { MOZ_CrashSequence(__null, 1015); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1016
1017 // Check '<'.
1018 MOZ_RELEASE_ASSERT(nothingValue < oneValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(nothingValue < oneValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(nothingValue < oneValue))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("nothingValue < oneValue"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1018); do {
} while (false); do { MOZ_CrashSequence(__null, 1018); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1019 MOZ_RELEASE_ASSERT(oneValue < twoValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(oneValue < twoValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(oneValue < twoValue))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("oneValue < twoValue"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1019); do {
} while (false); do { MOZ_CrashSequence(__null, 1019); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1020
1021 // Check '<='.
1022 MOZ_RELEASE_ASSERT(nothingValue <= anotherNothingValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(nothingValue <= anotherNothingValue)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(nothingValue <= anotherNothingValue))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("nothingValue <= anotherNothingValue"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1022); do {
} while (false); do { MOZ_CrashSequence(__null, 1022); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1023 MOZ_RELEASE_ASSERT(nothingValue <= oneValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(nothingValue <= oneValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(nothingValue <= oneValue)
)), 0))) { do { } while (false); MOZ_ReportAssertionFailure("nothingValue <= oneValue"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1023); do {
} while (false); do { MOZ_CrashSequence(__null, 1023); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1024 MOZ_RELEASE_ASSERT(oneValue <= oneValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(oneValue <= oneValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(oneValue <= oneValue))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("oneValue <= oneValue"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1024); do {
} while (false); do { MOZ_CrashSequence(__null, 1024); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1025 MOZ_RELEASE_ASSERT(oneValue <= twoValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(oneValue <= twoValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(oneValue <= twoValue))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("oneValue <= twoValue"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1025); do {
} while (false); do { MOZ_CrashSequence(__null, 1025); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1026
1027 // Check '>'.
1028 MOZ_RELEASE_ASSERT(oneValue > nothingValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(oneValue > nothingValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(oneValue > nothingValue))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("oneValue > nothingValue"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1028); do {
} while (false); do { MOZ_CrashSequence(__null, 1028); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1029 MOZ_RELEASE_ASSERT(twoValue > oneValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(twoValue > oneValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(twoValue > oneValue))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("twoValue > oneValue"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1029); do {
} while (false); do { MOZ_CrashSequence(__null, 1029); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1030
1031 // Check '>='.
1032 MOZ_RELEASE_ASSERT(nothingValue >= anotherNothingValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(nothingValue >= anotherNothingValue)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(nothingValue >= anotherNothingValue))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("nothingValue >= anotherNothingValue"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1032); do {
} while (false); do { MOZ_CrashSequence(__null, 1032); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1033 MOZ_RELEASE_ASSERT(oneValue >= nothingValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(oneValue >= nothingValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(oneValue >= nothingValue)
)), 0))) { do { } while (false); MOZ_ReportAssertionFailure("oneValue >= nothingValue"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1033); do {
} while (false); do { MOZ_CrashSequence(__null, 1033); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1034 MOZ_RELEASE_ASSERT(oneValue >= oneValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(oneValue >= oneValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(oneValue >= oneValue))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("oneValue >= oneValue"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1034); do {
} while (false); do { MOZ_CrashSequence(__null, 1034); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1035 MOZ_RELEASE_ASSERT(twoValue >= oneValue)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(twoValue >= oneValue)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(twoValue >= oneValue))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("twoValue >= oneValue"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1035); do {
} while (false); do { MOZ_CrashSequence(__null, 1035); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1036
1037 return true;
1038}
1039
1040// Check that Maybe<> can wrap a superclass that happens to also be a concrete
1041// class (i.e. that the compiler doesn't warn when we invoke the superclass's
1042// destructor explicitly in |reset()|.
1043class MySuperClass {
1044 virtual void VirtualMethod() { /* do nothing */ }
1045};
1046
1047class MyDerivedClass : public MySuperClass {
1048 void VirtualMethod() override { /* do nothing */ }
1049};
1050
1051static bool TestVirtualFunction() {
1052 Maybe<MySuperClass> super;
1053 super.emplace();
1054 super.reset();
1055
1056 Maybe<MyDerivedClass> derived;
1057 derived.emplace();
1058 derived.reset();
1059
1060 // If this compiles successfully, we've passed.
1061 return true;
1062}
1063
1064static Maybe<int*> ReturnSomeNullptr() { return Some(nullptr); }
1065
1066struct D {
1067 explicit D(const Maybe<int*>&) {}
1068};
1069
1070static bool TestSomeNullptrConversion() {
1071 Maybe<int*> m1 = Some(nullptr);
1072 MOZ_RELEASE_ASSERT(m1.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(m1.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(m1.isSome()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("m1.isSome()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1072); do { } while (false); do { MOZ_CrashSequence(__null,
1072); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1073 MOZ_RELEASE_ASSERT(m1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(m1)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(m1))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("m1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1073); do { } while (false); do { MOZ_CrashSequence(__null,
1073); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1074 MOZ_RELEASE_ASSERT(!*m1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!*m1)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(!*m1))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("!*m1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1074); do { } while (false); do { MOZ_CrashSequence(__null,
1074); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1075
1076 auto m2 = ReturnSomeNullptr();
1077 MOZ_RELEASE_ASSERT(m2.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(m2.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(m2.isSome()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("m2.isSome()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1077); do { } while (false); do { MOZ_CrashSequence(__null,
1077); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1078 MOZ_RELEASE_ASSERT(m2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(m2)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(m2))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("m2", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1078); do { } while (false); do { MOZ_CrashSequence(__null,
1078); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1079 MOZ_RELEASE_ASSERT(!*m2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!*m2)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(!*m2))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("!*m2", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1079); do { } while (false); do { MOZ_CrashSequence(__null,
1079); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1080
1081 Maybe<decltype(nullptr)> m3 = Some(nullptr);
1082 MOZ_RELEASE_ASSERT(m3.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(m3.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(m3.isSome()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("m3.isSome()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1082); do { } while (false); do { MOZ_CrashSequence(__null,
1082); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1083 MOZ_RELEASE_ASSERT(m3)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(m3)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(m3))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("m3", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1083); do { } while (false); do { MOZ_CrashSequence(__null,
1083); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1084 MOZ_RELEASE_ASSERT(*m3 == nullptr)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*m3 == nullptr)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*m3 == nullptr))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("*m3 == nullptr"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1084); do {
} while (false); do { MOZ_CrashSequence(__null, 1084); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1085
1086 D d(Some(nullptr));
1087
1088 return true;
1089}
1090
1091struct Base {};
1092struct Derived : Base {};
1093
1094static Maybe<Base*> ReturnDerivedPointer() {
1095 Derived* d = nullptr;
1096 return Some(d);
1097}
1098
1099struct ExplicitConstructorBasePointer {
1100 explicit ExplicitConstructorBasePointer(const Maybe<Base*>&) {}
1101};
1102
1103static bool TestSomePointerConversion() {
1104 Base base;
1105 Derived derived;
1106
1107 Maybe<Base*> m1 = Some(&derived);
1108 MOZ_RELEASE_ASSERT(m1.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(m1.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(m1.isSome()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("m1.isSome()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1108); do { } while (false); do { MOZ_CrashSequence(__null,
1108); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1109 MOZ_RELEASE_ASSERT(m1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(m1)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(m1))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("m1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1109); do { } while (false); do { MOZ_CrashSequence(__null,
1109); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1110 MOZ_RELEASE_ASSERT(*m1 == &derived)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*m1 == &derived)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*m1 == &derived))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("*m1 == &derived"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1110); do {
} while (false); do { MOZ_CrashSequence(__null, 1110); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1111
1112 auto m2 = ReturnDerivedPointer();
1113 MOZ_RELEASE_ASSERT(m2.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(m2.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(m2.isSome()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("m2.isSome()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1113); do { } while (false); do { MOZ_CrashSequence(__null,
1113); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1114 MOZ_RELEASE_ASSERT(m2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(m2)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(m2))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("m2", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1114); do { } while (false); do { MOZ_CrashSequence(__null,
1114); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1115 MOZ_RELEASE_ASSERT(*m2 == nullptr)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*m2 == nullptr)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*m2 == nullptr))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("*m2 == nullptr"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1115); do {
} while (false); do { MOZ_CrashSequence(__null, 1115); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1116
1117 Maybe<Base*> m3 = Some(&base);
1118 MOZ_RELEASE_ASSERT(m3.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(m3.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(m3.isSome()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("m3.isSome()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1118); do { } while (false); do { MOZ_CrashSequence(__null,
1118); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1119 MOZ_RELEASE_ASSERT(m3)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(m3)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(m3))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("m3", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1119); do { } while (false); do { MOZ_CrashSequence(__null,
1119); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1120 MOZ_RELEASE_ASSERT(*m3 == &base)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*m3 == &base)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*m3 == &base))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("*m3 == &base"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1120); do {
} while (false); do { MOZ_CrashSequence(__null, 1120); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1121
1122 auto s1 = Some(&derived);
1123 Maybe<Base*> c1(s1);
1124 MOZ_RELEASE_ASSERT(c1.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(c1.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(c1.isSome()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("c1.isSome()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1124); do { } while (false); do { MOZ_CrashSequence(__null,
1124); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1125 MOZ_RELEASE_ASSERT(c1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(c1)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(c1))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("c1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1125); do { } while (false); do { MOZ_CrashSequence(__null,
1125); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1126 MOZ_RELEASE_ASSERT(*c1 == &derived)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*c1 == &derived)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*c1 == &derived))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("*c1 == &derived"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1126); do {
} while (false); do { MOZ_CrashSequence(__null, 1126); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1127
1128 ExplicitConstructorBasePointer ecbp(Some(&derived));
1129
1130 return true;
1131}
1132
1133struct SourceType1 {
1134 int mTag;
1135
1136 operator int() const { return mTag; }
1137};
1138struct DestType {
1139 int mTag;
1140 Status mStatus;
1141
1142 DestType() : mTag(0), mStatus(eWasDefaultConstructed) {}
1143
1144 MOZ_IMPLICIT DestType(int aTag) : mTag(aTag), mStatus(eWasConstructed) {}
1145
1146 MOZ_IMPLICIT DestType(SourceType1&& aSrc)
1147 : mTag(aSrc.mTag), mStatus(eWasMoveConstructed) {}
1148
1149 MOZ_IMPLICIT DestType(const SourceType1& aSrc)
1150 : mTag(aSrc.mTag), mStatus(eWasCopyConstructed) {}
1151
1152 DestType& operator=(int aTag) {
1153 mTag = aTag;
1154 mStatus = eWasAssigned;
1155 return *this;
1156 }
1157
1158 DestType& operator=(SourceType1&& aSrc) {
1159 mTag = aSrc.mTag;
1160 mStatus = eWasMoveAssigned;
1161 return *this;
1162 }
1163
1164 DestType& operator=(const SourceType1& aSrc) {
1165 mTag = aSrc.mTag;
1166 mStatus = eWasCopyAssigned;
1167 return *this;
1168 }
1169};
1170struct SourceType2 {
1171 int mTag;
1172
1173 operator DestType() const& {
1174 DestType result;
1175 result.mTag = mTag;
1176 result.mStatus = eWasCopiedFrom;
1177 return result;
1178 }
1179
1180 operator DestType() && {
1181 DestType result;
1182 result.mTag = mTag;
1183 result.mStatus = eWasMovedFrom;
1184 return result;
1185 }
1186};
1187
1188static bool TestTypeConversion() {
1189 {
1190 Maybe<SourceType1> src = Some(SourceType1{1});
1191 Maybe<DestType> dest = src;
1192 MOZ_RELEASE_ASSERT(src.isSome() && src->mTag == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isSome() && src->mTag == 1)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(src.isSome() && src->mTag == 1))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("src.isSome() && src->mTag == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1192); do {
} while (false); do { MOZ_CrashSequence(__null, 1192); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1193 MOZ_RELEASE_ASSERT(dest.isSome() && dest->mTag == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && dest->mTag == 1)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(dest.isSome() && dest->mTag == 1))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("dest.isSome() && dest->mTag == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1193); do {
} while (false); do { MOZ_CrashSequence(__null, 1193); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1194 MOZ_RELEASE_ASSERT(dest->mStatus == eWasCopyConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest->mStatus == eWasCopyConstructed)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(dest->mStatus == eWasCopyConstructed))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("dest->mStatus == eWasCopyConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1194); do {
} while (false); do { MOZ_CrashSequence(__null, 1194); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1195
1196 src = Some(SourceType1{2});
1197 dest = src;
1198 MOZ_RELEASE_ASSERT(src.isSome() && src->mTag == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isSome() && src->mTag == 2)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(src.isSome() && src->mTag == 2))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("src.isSome() && src->mTag == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1198); do {
} while (false); do { MOZ_CrashSequence(__null, 1198); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1199 MOZ_RELEASE_ASSERT(dest.isSome() && dest->mTag == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && dest->mTag == 2)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(dest.isSome() && dest->mTag == 2))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("dest.isSome() && dest->mTag == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1199); do {
} while (false); do { MOZ_CrashSequence(__null, 1199); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1200 MOZ_RELEASE_ASSERT(dest->mStatus == eWasCopyAssigned)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest->mStatus == eWasCopyAssigned)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest->mStatus == eWasCopyAssigned
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"dest->mStatus == eWasCopyAssigned", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1200); do { } while (false); do { MOZ_CrashSequence(__null,
1200); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1201 }
1202
1203 {
1204 Maybe<SourceType1> src = Some(SourceType1{1});
1205 Maybe<DestType> dest = std::move(src);
1206 MOZ_RELEASE_ASSERT(src.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(src.isNothing()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("src.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1206); do {
} while (false); do { MOZ_CrashSequence(__null, 1206); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1207 MOZ_RELEASE_ASSERT(dest.isSome() && dest->mTag == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && dest->mTag == 1)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(dest.isSome() && dest->mTag == 1))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("dest.isSome() && dest->mTag == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1207); do {
} while (false); do { MOZ_CrashSequence(__null, 1207); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1208 MOZ_RELEASE_ASSERT(dest->mStatus == eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest->mStatus == eWasMoveConstructed)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(dest->mStatus == eWasMoveConstructed))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("dest->mStatus == eWasMoveConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1208); do {
} while (false); do { MOZ_CrashSequence(__null, 1208); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1209
1210 src = Some(SourceType1{2});
1211 dest = std::move(src);
1212 MOZ_RELEASE_ASSERT(src.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(src.isNothing()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("src.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1212); do {
} while (false); do { MOZ_CrashSequence(__null, 1212); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1213 MOZ_RELEASE_ASSERT(dest.isSome() && dest->mTag == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && dest->mTag == 2)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(dest.isSome() && dest->mTag == 2))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("dest.isSome() && dest->mTag == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1213); do {
} while (false); do { MOZ_CrashSequence(__null, 1213); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1214 MOZ_RELEASE_ASSERT(dest->mStatus == eWasMoveAssigned)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest->mStatus == eWasMoveAssigned)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest->mStatus == eWasMoveAssigned
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"dest->mStatus == eWasMoveAssigned", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1214); do { } while (false); do { MOZ_CrashSequence(__null,
1214); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1215 }
1216
1217 {
1218 Maybe<SourceType2> src = Some(SourceType2{1});
1219 Maybe<DestType> dest = src;
1220 MOZ_RELEASE_ASSERT(src.isSome() && src->mTag == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isSome() && src->mTag == 1)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(src.isSome() && src->mTag == 1))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("src.isSome() && src->mTag == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1220); do {
} while (false); do { MOZ_CrashSequence(__null, 1220); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1221 MOZ_RELEASE_ASSERT(dest.isSome() && dest->mTag == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && dest->mTag == 1)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(dest.isSome() && dest->mTag == 1))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("dest.isSome() && dest->mTag == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1221); do {
} while (false); do { MOZ_CrashSequence(__null, 1221); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1222 MOZ_RELEASE_ASSERT(dest->mStatus == eWasCopiedFrom)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest->mStatus == eWasCopiedFrom)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest->mStatus == eWasCopiedFrom
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"dest->mStatus == eWasCopiedFrom", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1222); do { } while (false); do { MOZ_CrashSequence(__null,
1222); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1223
1224 src = Some(SourceType2{2});
1225 dest = src;
1226 MOZ_RELEASE_ASSERT(src.isSome() && src->mTag == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isSome() && src->mTag == 2)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(src.isSome() && src->mTag == 2))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("src.isSome() && src->mTag == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1226); do {
} while (false); do { MOZ_CrashSequence(__null, 1226); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1227 MOZ_RELEASE_ASSERT(dest.isSome() && dest->mTag == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && dest->mTag == 2)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(dest.isSome() && dest->mTag == 2))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("dest.isSome() && dest->mTag == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1227); do {
} while (false); do { MOZ_CrashSequence(__null, 1227); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1228 MOZ_RELEASE_ASSERT(dest->mStatus == eWasCopiedFrom)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest->mStatus == eWasCopiedFrom)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest->mStatus == eWasCopiedFrom
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"dest->mStatus == eWasCopiedFrom", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1228); do { } while (false); do { MOZ_CrashSequence(__null,
1228); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1229 }
1230
1231 {
1232 Maybe<SourceType2> src = Some(SourceType2{1});
1233 Maybe<DestType> dest = std::move(src);
1234 MOZ_RELEASE_ASSERT(src.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(src.isNothing()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("src.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1234); do {
} while (false); do { MOZ_CrashSequence(__null, 1234); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1235 MOZ_RELEASE_ASSERT(dest.isSome() && dest->mTag == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && dest->mTag == 1)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(dest.isSome() && dest->mTag == 1))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("dest.isSome() && dest->mTag == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1235); do {
} while (false); do { MOZ_CrashSequence(__null, 1235); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1236 MOZ_RELEASE_ASSERT(dest->mStatus == eWasMovedFrom)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest->mStatus == eWasMovedFrom)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest->mStatus == eWasMovedFrom
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"dest->mStatus == eWasMovedFrom", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1236); do { } while (false); do { MOZ_CrashSequence(__null,
1236); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1237
1238 src = Some(SourceType2{2});
1239 dest = std::move(src);
1240 MOZ_RELEASE_ASSERT(src.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(src.isNothing()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("src.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1240); do {
} while (false); do { MOZ_CrashSequence(__null, 1240); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1241 MOZ_RELEASE_ASSERT(dest.isSome() && dest->mTag == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && dest->mTag == 2)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(dest.isSome() && dest->mTag == 2))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("dest.isSome() && dest->mTag == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1241); do {
} while (false); do { MOZ_CrashSequence(__null, 1241); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1242 MOZ_RELEASE_ASSERT(dest->mStatus == eWasMovedFrom)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest->mStatus == eWasMovedFrom)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest->mStatus == eWasMovedFrom
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"dest->mStatus == eWasMovedFrom", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1242); do { } while (false); do { MOZ_CrashSequence(__null,
1242); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1243 }
1244
1245 {
1246 Maybe<int> src = Some(1);
1247 Maybe<DestType> dest = src;
1248 MOZ_RELEASE_ASSERT(src.isSome() && *src == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isSome() && *src == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(src.isSome() && *src
== 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("src.isSome() && *src == 1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1248); do { } while (false); do { MOZ_CrashSequence(__null,
1248); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1249 MOZ_RELEASE_ASSERT(dest.isSome() && dest->mTag == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && dest->mTag == 1)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(dest.isSome() && dest->mTag == 1))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("dest.isSome() && dest->mTag == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1249); do {
} while (false); do { MOZ_CrashSequence(__null, 1249); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1250 MOZ_RELEASE_ASSERT(dest->mStatus == eWasConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest->mStatus == eWasConstructed)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest->mStatus == eWasConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"dest->mStatus == eWasConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1250); do { } while (false); do { MOZ_CrashSequence(__null,
1250); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1251
1252 src = Some(2);
1253 dest = src;
1254 MOZ_RELEASE_ASSERT(src.isSome() && *src == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isSome() && *src == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(src.isSome() && *src
== 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("src.isSome() && *src == 2", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1254); do { } while (false); do { MOZ_CrashSequence(__null,
1254); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1255 MOZ_RELEASE_ASSERT(dest.isSome() && dest->mTag == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && dest->mTag == 2)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(dest.isSome() && dest->mTag == 2))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("dest.isSome() && dest->mTag == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1255); do {
} while (false); do { MOZ_CrashSequence(__null, 1255); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1256 MOZ_RELEASE_ASSERT(dest->mStatus == eWasAssigned)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest->mStatus == eWasAssigned)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest->mStatus == eWasAssigned
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"dest->mStatus == eWasAssigned", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1256); do { } while (false); do { MOZ_CrashSequence(__null,
1256); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1257 }
1258
1259 {
1260 Maybe<int> src = Some(1);
1261 Maybe<DestType> dest = std::move(src);
1262 MOZ_RELEASE_ASSERT(src.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(src.isNothing()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("src.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1262); do {
} while (false); do { MOZ_CrashSequence(__null, 1262); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1263 MOZ_RELEASE_ASSERT(dest.isSome() && dest->mTag == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && dest->mTag == 1)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(dest.isSome() && dest->mTag == 1))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("dest.isSome() && dest->mTag == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1263); do {
} while (false); do { MOZ_CrashSequence(__null, 1263); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1264 MOZ_RELEASE_ASSERT(dest->mStatus == eWasConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest->mStatus == eWasConstructed)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest->mStatus == eWasConstructed
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"dest->mStatus == eWasConstructed", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1264); do { } while (false); do { MOZ_CrashSequence(__null,
1264); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1265
1266 src = Some(2);
1267 dest = std::move(src);
1268 MOZ_RELEASE_ASSERT(src.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(src.isNothing()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("src.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1268); do {
} while (false); do { MOZ_CrashSequence(__null, 1268); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1269 MOZ_RELEASE_ASSERT(dest.isSome() && dest->mTag == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && dest->mTag == 2)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(dest.isSome() && dest->mTag == 2))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("dest.isSome() && dest->mTag == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1269); do {
} while (false); do { MOZ_CrashSequence(__null, 1269); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1270 MOZ_RELEASE_ASSERT(dest->mStatus == eWasAssigned)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest->mStatus == eWasAssigned)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest->mStatus == eWasAssigned
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"dest->mStatus == eWasAssigned", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1270); do { } while (false); do { MOZ_CrashSequence(__null,
1270); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1271 }
1272
1273 {
1274 Maybe<SourceType1> src = Some(SourceType1{1});
1275 Maybe<int> dest = src;
1276 MOZ_RELEASE_ASSERT(src.isSome() && src->mTag == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isSome() && src->mTag == 1)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(src.isSome() && src->mTag == 1))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("src.isSome() && src->mTag == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1276); do {
} while (false); do { MOZ_CrashSequence(__null, 1276); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1277 MOZ_RELEASE_ASSERT(dest.isSome() && *dest == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && *dest == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest.isSome() && *dest
== 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("dest.isSome() && *dest == 1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1277); do { } while (false); do { MOZ_CrashSequence(__null,
1277); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1278
1279 src = Some(SourceType1{2});
1280 dest = src;
1281 MOZ_RELEASE_ASSERT(src.isSome() && src->mTag == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isSome() && src->mTag == 2)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(src.isSome() && src->mTag == 2))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("src.isSome() && src->mTag == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1281); do {
} while (false); do { MOZ_CrashSequence(__null, 1281); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1282 MOZ_RELEASE_ASSERT(dest.isSome() && *dest == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && *dest == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest.isSome() && *dest
== 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("dest.isSome() && *dest == 2", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1282); do { } while (false); do { MOZ_CrashSequence(__null,
1282); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1283 }
1284
1285 {
1286 Maybe<SourceType1> src = Some(SourceType1{1});
1287 Maybe<int> dest = std::move(src);
1288 MOZ_RELEASE_ASSERT(src.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(src.isNothing()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("src.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1288); do {
} while (false); do { MOZ_CrashSequence(__null, 1288); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1289 MOZ_RELEASE_ASSERT(dest.isSome() && *dest == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && *dest == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest.isSome() && *dest
== 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("dest.isSome() && *dest == 1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1289); do { } while (false); do { MOZ_CrashSequence(__null,
1289); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1290
1291 src = Some(SourceType1{2});
1292 dest = std::move(src);
1293 MOZ_RELEASE_ASSERT(src.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(src.isNothing()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("src.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1293); do {
} while (false); do { MOZ_CrashSequence(__null, 1293); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1294 MOZ_RELEASE_ASSERT(dest.isSome() && *dest == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && *dest == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest.isSome() && *dest
== 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("dest.isSome() && *dest == 2", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1294); do { } while (false); do { MOZ_CrashSequence(__null,
1294); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1295 }
1296
1297 {
1298 Maybe<size_t> src = Some(1);
1299 Maybe<char16_t> dest = src;
1300 MOZ_RELEASE_ASSERT(src.isSome() && *src == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isSome() && *src == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(src.isSome() && *src
== 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("src.isSome() && *src == 1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1300); do { } while (false); do { MOZ_CrashSequence(__null,
1300); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1301 MOZ_RELEASE_ASSERT(dest.isSome() && *dest == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && *dest == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest.isSome() && *dest
== 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("dest.isSome() && *dest == 1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1301); do { } while (false); do { MOZ_CrashSequence(__null,
1301); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1302
1303 src = Some(2);
1304 dest = src;
1305 MOZ_RELEASE_ASSERT(src.isSome() && *src == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isSome() && *src == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(src.isSome() && *src
== 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("src.isSome() && *src == 2", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1305); do { } while (false); do { MOZ_CrashSequence(__null,
1305); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1306 MOZ_RELEASE_ASSERT(dest.isSome() && *dest == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && *dest == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest.isSome() && *dest
== 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("dest.isSome() && *dest == 2", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1306); do { } while (false); do { MOZ_CrashSequence(__null,
1306); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1307 }
1308
1309 {
1310 Maybe<size_t> src = Some(1);
1311 Maybe<char16_t> dest = std::move(src);
1312 MOZ_RELEASE_ASSERT(src.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(src.isNothing()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("src.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1312); do {
} while (false); do { MOZ_CrashSequence(__null, 1312); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1313 MOZ_RELEASE_ASSERT(dest.isSome() && *dest == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && *dest == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest.isSome() && *dest
== 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("dest.isSome() && *dest == 1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1313); do { } while (false); do { MOZ_CrashSequence(__null,
1313); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1314
1315 src = Some(2);
1316 dest = std::move(src);
1317 MOZ_RELEASE_ASSERT(src.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(src.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(src.isNothing()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("src.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1317); do {
} while (false); do { MOZ_CrashSequence(__null, 1317); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1318 MOZ_RELEASE_ASSERT(dest.isSome() && *dest == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(dest.isSome() && *dest == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(dest.isSome() && *dest
== 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("dest.isSome() && *dest == 2", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1318); do { } while (false); do { MOZ_CrashSequence(__null,
1318); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1319 }
1320
1321 return true;
1322}
1323
1324static bool TestReference() {
1325 static_assert(std::is_trivially_destructible_v<Maybe<int&>>);
1326 static_assert(std::is_trivially_copy_constructible_v<Maybe<int&>>);
1327 static_assert(std::is_trivially_copy_assignable_v<Maybe<int&>>);
1328
1329 static_assert(Maybe<int&>{}.isNothing());
1330 static_assert(Maybe<int&>{Nothing{}}.isNothing());
1331
1332 {
1333 Maybe<int&> defaultConstructed;
1334
1335 MOZ_RELEASE_ASSERT(defaultConstructed.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(defaultConstructed.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(defaultConstructed.isNothing
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("defaultConstructed.isNothing()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1335); do { } while (false); do { MOZ_CrashSequence(__null,
1335); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1336 MOZ_RELEASE_ASSERT(!defaultConstructed.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!defaultConstructed.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!defaultConstructed.isSome()
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"!defaultConstructed.isSome()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1336); do { } while (false); do { MOZ_CrashSequence(__null,
1336); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1337 MOZ_RELEASE_ASSERT(!defaultConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!defaultConstructed)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!defaultConstructed))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("!defaultConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1337); do {
} while (false); do { MOZ_CrashSequence(__null, 1337); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1338 }
1339
1340 {
1341 Maybe<int&> nothing = Nothing();
1342
1343 MOZ_RELEASE_ASSERT(nothing.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(nothing.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(nothing.isNothing()))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("nothing.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1343); do {
} while (false); do { MOZ_CrashSequence(__null, 1343); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1344 MOZ_RELEASE_ASSERT(!nothing.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!nothing.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!nothing.isSome()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("!nothing.isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1344); do {
} while (false); do { MOZ_CrashSequence(__null, 1344); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1345 MOZ_RELEASE_ASSERT(!nothing)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!nothing)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!nothing))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("!nothing", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1345); do { } while (false); do { MOZ_CrashSequence(__null,
1345); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1346 }
1347
1348 {
1349 int foo = 42, bar = 42;
1350 Maybe<int&> some = SomeRef(foo);
1351
1352 MOZ_RELEASE_ASSERT(!some.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!some.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!some.isNothing()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("!some.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1352); do {
} while (false); do { MOZ_CrashSequence(__null, 1352); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1353 MOZ_RELEASE_ASSERT(some.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(some.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(some.isSome()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("some.isSome()",
"/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1353); do { }
while (false); do { MOZ_CrashSequence(__null, 1353); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1354 MOZ_RELEASE_ASSERT(some)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(some)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(some))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("some", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1354); do { } while (false); do { MOZ_CrashSequence(__null,
1354); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1355 MOZ_RELEASE_ASSERT(&some.ref() == &foo)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(&some.ref() == &foo)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(&some.ref() == &foo)
)), 0))) { do { } while (false); MOZ_ReportAssertionFailure("&some.ref() == &foo"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1355); do {
} while (false); do { MOZ_CrashSequence(__null, 1355); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1356
1357 MOZ_RELEASE_ASSERT(some.refEquals(foo))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(some.refEquals(foo))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(some.refEquals(foo)))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("some.refEquals(foo)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1357); do {
} while (false); do { MOZ_CrashSequence(__null, 1357); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1358 MOZ_RELEASE_ASSERT(some.refEquals(SomeRef(foo)))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(some.refEquals(SomeRef(foo)))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(some.refEquals(SomeRef(foo))
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"some.refEquals(SomeRef(foo))", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1358); do { } while (false); do { MOZ_CrashSequence(__null,
1358); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1359 MOZ_RELEASE_ASSERT(!some.refEquals(Nothing()))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!some.refEquals(Nothing()))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!some.refEquals(Nothing())))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!some.refEquals(Nothing())"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1359); do {
} while (false); do { MOZ_CrashSequence(__null, 1359); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1360 MOZ_RELEASE_ASSERT(!some.refEquals(bar))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!some.refEquals(bar))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!some.refEquals(bar)))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("!some.refEquals(bar)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1360); do {
} while (false); do { MOZ_CrashSequence(__null, 1360); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1361 MOZ_RELEASE_ASSERT(!some.refEquals(SomeRef(bar)))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!some.refEquals(SomeRef(bar)))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!some.refEquals(SomeRef(bar)
)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("!some.refEquals(SomeRef(bar))", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1361); do { } while (false); do { MOZ_CrashSequence(__null,
1361); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1362
1363 some.ref()++;
1364 MOZ_RELEASE_ASSERT(43 == foo)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(43 == foo)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(43 == foo))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("43 == foo", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1364); do { } while (false); do { MOZ_CrashSequence(__null,
1364); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1365
1366 (*some)++;
1367 MOZ_RELEASE_ASSERT(44 == foo)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(44 == foo)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(44 == foo))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("44 == foo", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1367); do { } while (false); do { MOZ_CrashSequence(__null,
1367); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1368 }
1369
1370 {
1371 int foo = 42, bar = 42;
1372 Maybe<int&> some;
1373 some.emplace(foo);
1374
1375 MOZ_RELEASE_ASSERT(!some.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!some.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!some.isNothing()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("!some.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1375); do {
} while (false); do { MOZ_CrashSequence(__null, 1375); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1376 MOZ_RELEASE_ASSERT(some.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(some.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(some.isSome()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("some.isSome()",
"/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1376); do { }
while (false); do { MOZ_CrashSequence(__null, 1376); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1377 MOZ_RELEASE_ASSERT(some)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(some)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(some))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("some", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1377); do { } while (false); do { MOZ_CrashSequence(__null,
1377); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1378 MOZ_RELEASE_ASSERT(&some.ref() == &foo)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(&some.ref() == &foo)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(&some.ref() == &foo)
)), 0))) { do { } while (false); MOZ_ReportAssertionFailure("&some.ref() == &foo"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1378); do {
} while (false); do { MOZ_CrashSequence(__null, 1378); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1379
1380 MOZ_RELEASE_ASSERT(some.refEquals(foo))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(some.refEquals(foo))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(some.refEquals(foo)))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("some.refEquals(foo)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1380); do {
} while (false); do { MOZ_CrashSequence(__null, 1380); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1381 MOZ_RELEASE_ASSERT(some.refEquals(SomeRef(foo)))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(some.refEquals(SomeRef(foo)))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(some.refEquals(SomeRef(foo))
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"some.refEquals(SomeRef(foo))", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1381); do { } while (false); do { MOZ_CrashSequence(__null,
1381); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1382 MOZ_RELEASE_ASSERT(!some.refEquals(Nothing()))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!some.refEquals(Nothing()))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!some.refEquals(Nothing())))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!some.refEquals(Nothing())"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1382); do {
} while (false); do { MOZ_CrashSequence(__null, 1382); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1383 MOZ_RELEASE_ASSERT(!some.refEquals(bar))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!some.refEquals(bar))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!some.refEquals(bar)))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("!some.refEquals(bar)"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1383); do {
} while (false); do { MOZ_CrashSequence(__null, 1383); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1384 MOZ_RELEASE_ASSERT(!some.refEquals(SomeRef(bar)))do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!some.refEquals(SomeRef(bar)))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!some.refEquals(SomeRef(bar)
)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("!some.refEquals(SomeRef(bar))", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1384); do { } while (false); do { MOZ_CrashSequence(__null,
1384); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1385
1386 some.ref()++;
1387 MOZ_RELEASE_ASSERT(43 == foo)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(43 == foo)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(43 == foo))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("43 == foo", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1387); do { } while (false); do { MOZ_CrashSequence(__null,
1387); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1388 }
1389
1390 {
1391 Maybe<int&> defaultConstructed;
1392 defaultConstructed.reset();
1393
1394 MOZ_RELEASE_ASSERT(defaultConstructed.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(defaultConstructed.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(defaultConstructed.isNothing
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("defaultConstructed.isNothing()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1394); do { } while (false); do { MOZ_CrashSequence(__null,
1394); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1395 MOZ_RELEASE_ASSERT(!defaultConstructed.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!defaultConstructed.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!defaultConstructed.isSome()
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"!defaultConstructed.isSome()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1395); do { } while (false); do { MOZ_CrashSequence(__null,
1395); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1396 MOZ_RELEASE_ASSERT(!defaultConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!defaultConstructed)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!defaultConstructed))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("!defaultConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1396); do {
} while (false); do { MOZ_CrashSequence(__null, 1396); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1397 }
1398
1399 {
1400 int foo = 42;
1401 Maybe<int&> some = SomeRef(foo);
1402 some.reset();
1403
1404 MOZ_RELEASE_ASSERT(some.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(some.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(some.isNothing()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("some.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1404); do {
} while (false); do { MOZ_CrashSequence(__null, 1404); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1405 MOZ_RELEASE_ASSERT(!some.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!some.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!some.isSome()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("!some.isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1405); do {
} while (false); do { MOZ_CrashSequence(__null, 1405); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1406 MOZ_RELEASE_ASSERT(!some)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!some)>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(!some))), 0))) { do { } while (
false); MOZ_ReportAssertionFailure("!some", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1406); do { } while (false); do { MOZ_CrashSequence(__null,
1406); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1407 }
1408
1409 {
1410 int foo = 42;
1411 Maybe<int&> some = SomeRef(foo);
1412
1413 auto& applied = some.apply([](int& ref) { ref++; });
1414
1415 MOZ_RELEASE_ASSERT(&some == &applied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(&some == &applied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(&some == &applied)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("&some == &applied"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1415); do {
} while (false); do { MOZ_CrashSequence(__null, 1415); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1416 MOZ_RELEASE_ASSERT(43 == foo)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(43 == foo)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(43 == foo))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("43 == foo", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1416); do { } while (false); do { MOZ_CrashSequence(__null,
1416); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1417 }
1418
1419 {
1420 Maybe<int&> nothing;
1421
1422 auto& applied = nothing.apply([](int& ref) { ref++; });
1423
1424 MOZ_RELEASE_ASSERT(&nothing == &applied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(&nothing == &applied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(&nothing == &applied
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"&nothing == &applied", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1424); do { } while (false); do { MOZ_CrashSequence(__null,
1424); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1425 }
1426
1427 {
1428 int foo = 42;
1429 Maybe<int&> some = SomeRef(foo);
1430
1431 auto mapped = some.map([](int& ref) { return &ref; });
1432 static_assert(std::is_same_v<decltype(mapped), Maybe<int*>>);
1433
1434 MOZ_RELEASE_ASSERT(&foo == *mapped)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(&foo == *mapped)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(&foo == *mapped))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("&foo == *mapped"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1434); do {
} while (false); do { MOZ_CrashSequence(__null, 1434); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1435 }
1436
1437 {
1438 Maybe<int&> nothing;
1439
1440 auto mapped = nothing.map([](int& ref) { return &ref; });
1441
1442 MOZ_RELEASE_ASSERT(mapped.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mapped.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mapped.isNothing()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("mapped.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1442); do {
} while (false); do { MOZ_CrashSequence(__null, 1442); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1443 MOZ_RELEASE_ASSERT(!mapped.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!mapped.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!mapped.isSome()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("!mapped.isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1443); do {
} while (false); do { MOZ_CrashSequence(__null, 1443); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1444 MOZ_RELEASE_ASSERT(!mapped)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!mapped)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!mapped))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("!mapped", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1444); do { } while (false); do { MOZ_CrashSequence(__null,
1444); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1445 }
1446
1447 {
1448 int foo = 42;
1449 auto someRef = ToMaybeRef(&foo);
1450
1451 static_assert(std::is_same_v<decltype(someRef), Maybe<int&>>);
1452
1453 MOZ_RELEASE_ASSERT(someRef.isSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(someRef.isSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(someRef.isSome()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("someRef.isSome()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1453); do {
} while (false); do { MOZ_CrashSequence(__null, 1453); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1454 MOZ_RELEASE_ASSERT(&foo == &someRef.ref())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(&foo == &someRef.ref())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(&foo == &someRef.ref
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("&foo == &someRef.ref()", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1454); do { } while (false); do { MOZ_CrashSequence(__null,
1454); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1455 }
1456
1457 {
1458 int* fooPtr = nullptr;
1459 auto someRef = ToMaybeRef(fooPtr);
1460
1461 static_assert(std::is_same_v<decltype(someRef), Maybe<int&>>);
1462
1463 MOZ_RELEASE_ASSERT(someRef.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(someRef.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(someRef.isNothing()))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("someRef.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1463); do {
} while (false); do { MOZ_CrashSequence(__null, 1463); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1464 }
1465
1466 return true;
1467}
1468
1469static Maybe<int> IncrementAndReturnTag(BasicValue& aValue) {
1470 gFunctionWasApplied = true;
1471 aValue.SetTag(aValue.GetTag() + 1);
1472 return Some(aValue.GetTag());
1473}
1474
1475static Maybe<int> AccessValueAndReturnNothing(const BasicValue&) {
1476 gFunctionWasApplied = true;
1477 return Nothing();
1478}
1479
1480static Maybe<int> AccessValueAndReturnOther(const BasicValue&) {
1481 gFunctionWasApplied = true;
1482 return Some(42);
1483}
1484
1485struct IncrementAndReturnTagFunctor {
1486 IncrementAndReturnTagFunctor() : mBy(1) {}
1487
1488 Maybe<int> operator()(BasicValue& aValue) {
1489 aValue.SetTag(aValue.GetTag() + mBy.GetTag());
1490 return Some(aValue.GetTag());
1491 }
1492
1493 BasicValue mBy;
1494};
1495
1496struct AccessValueAndReturnOtherFunctor {
1497 explicit AccessValueAndReturnOtherFunctor(int aVal) : mBy(aVal) {}
1498
1499 Maybe<BasicValue> operator()() {
1500 gFunctionWasApplied = true;
1501 return Some(mBy);
1502 }
1503
1504 BasicValue mBy;
1505};
1506
1507static bool TestAndThen() {
1508 // Check that andThen handles the 'Nothing' case.
1509 gFunctionWasApplied = false;
1510 Maybe<BasicValue> mayValue;
1511 Maybe<int> otherValue = mayValue.andThen(&AccessValueAndReturnOther);
1512 MOZ_RELEASE_ASSERT(!gFunctionWasApplied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!gFunctionWasApplied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!gFunctionWasApplied))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("!gFunctionWasApplied"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1512); do {
} while (false); do { MOZ_CrashSequence(__null, 1512); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1513 MOZ_RELEASE_ASSERT(otherValue.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(otherValue.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(otherValue.isNothing()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("otherValue.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1513); do {
} while (false); do { MOZ_CrashSequence(__null, 1513); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1514
1515 // Check that andThen handles the 'Some' case.
1516 mayValue = Some(BasicValue(1));
1517 otherValue = mayValue.andThen(&AccessValueAndReturnNothing);
1518 MOZ_RELEASE_ASSERT(gFunctionWasApplied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(gFunctionWasApplied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(gFunctionWasApplied))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("gFunctionWasApplied"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1518); do {
} while (false); do { MOZ_CrashSequence(__null, 1518); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1519 MOZ_RELEASE_ASSERT(otherValue.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(otherValue.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(otherValue.isNothing()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("otherValue.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1519); do {
} while (false); do { MOZ_CrashSequence(__null, 1519); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1520 gFunctionWasApplied = false;
1521 otherValue = mayValue.andThen(&IncrementAndReturnTag);
1522 MOZ_RELEASE_ASSERT(gFunctionWasApplied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(gFunctionWasApplied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(gFunctionWasApplied))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("gFunctionWasApplied"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1522); do {
} while (false); do { MOZ_CrashSequence(__null, 1522); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1523 MOZ_RELEASE_ASSERT(mayValue->GetTag() == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue->GetTag() == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue->GetTag() == 2))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("mayValue->GetTag() == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1523); do {
} while (false); do { MOZ_CrashSequence(__null, 1523); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1524 MOZ_RELEASE_ASSERT(*otherValue == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*otherValue == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*otherValue == 2))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("*otherValue == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1524); do {
} while (false); do { MOZ_CrashSequence(__null, 1524); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1525 gFunctionWasApplied = false;
1526 otherValue = mayValue.andThen(&AccessValueAndReturnOther);
1527 MOZ_RELEASE_ASSERT(gFunctionWasApplied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(gFunctionWasApplied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(gFunctionWasApplied))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("gFunctionWasApplied"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1527); do {
} while (false); do { MOZ_CrashSequence(__null, 1527); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1528 MOZ_RELEASE_ASSERT(*otherValue == 42)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*otherValue == 42)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*otherValue == 42))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("*otherValue == 42"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1528); do {
} while (false); do { MOZ_CrashSequence(__null, 1528); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1529
1530 // Check that andThen works with a const reference.
1531 const Maybe<BasicValue>& mayValueCRef = mayValue;
1532 gFunctionWasApplied = false;
1533 otherValue = mayValueCRef.andThen(&AccessValueAndReturnOther);
1534 MOZ_RELEASE_ASSERT(gFunctionWasApplied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(gFunctionWasApplied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(gFunctionWasApplied))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("gFunctionWasApplied"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1534); do {
} while (false); do { MOZ_CrashSequence(__null, 1534); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1535 MOZ_RELEASE_ASSERT(*otherValue == 42)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*otherValue == 42)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*otherValue == 42))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("*otherValue == 42"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1535); do {
} while (false); do { MOZ_CrashSequence(__null, 1535); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1536
1537 // Check that andThen works with functors.
1538 IncrementAndReturnTagFunctor tagIncrementer;
1539 MOZ_RELEASE_ASSERT(tagIncrementer.mBy.GetStatus() == eWasConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(tagIncrementer.mBy.GetStatus() == eWasConstructed)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(tagIncrementer.mBy.GetStatus() == eWasConstructed)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("tagIncrementer.mBy.GetStatus() == eWasConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1539); do {
} while (false); do { MOZ_CrashSequence(__null, 1539); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1540 mayValue = Some(BasicValue(1));
1541 otherValue = mayValue.andThen(tagIncrementer);
1542 MOZ_RELEASE_ASSERT(mayValue->GetTag() == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue->GetTag() == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue->GetTag() == 2))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("mayValue->GetTag() == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1542); do {
} while (false); do { MOZ_CrashSequence(__null, 1542); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1543 MOZ_RELEASE_ASSERT(*otherValue == 2)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*otherValue == 2)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*otherValue == 2))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("*otherValue == 2"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1543); do {
} while (false); do { MOZ_CrashSequence(__null, 1543); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1544 MOZ_RELEASE_ASSERT(tagIncrementer.mBy.GetStatus() == eWasConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(tagIncrementer.mBy.GetStatus() == eWasConstructed)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(tagIncrementer.mBy.GetStatus() == eWasConstructed)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("tagIncrementer.mBy.GetStatus() == eWasConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1544); do {
} while (false); do { MOZ_CrashSequence(__null, 1544); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1545
1546 // Check that andThen works with lambda expressions.
1547 gFunctionWasApplied = false;
1548 mayValue = Some(BasicValue(2));
1549 otherValue = mayValue.andThen(
1550 [](BasicValue& aVal) { return Some(aVal.GetTag() * 2); });
1551 MOZ_RELEASE_ASSERT(*otherValue == 4)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*otherValue == 4)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*otherValue == 4))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("*otherValue == 4"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1551); do {
} while (false); do { MOZ_CrashSequence(__null, 1551); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1552 otherValue = otherValue.andThen([](int aVal) { return Some(aVal * 2); });
1553 MOZ_RELEASE_ASSERT(*otherValue == 8)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*otherValue == 8)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*otherValue == 8))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("*otherValue == 8"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1553); do {
} while (false); do { MOZ_CrashSequence(__null, 1553); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1554 otherValue = mayValueCRef.andThen([&](const BasicValue& aVal) {
1555 gFunctionWasApplied = true;
1556 return Some(42);
1557 });
1558 MOZ_RELEASE_ASSERT(gFunctionWasApplied == true)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(gFunctionWasApplied == true)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(gFunctionWasApplied == true)
)), 0))) { do { } while (false); MOZ_ReportAssertionFailure("gFunctionWasApplied == true"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1558); do {
} while (false); do { MOZ_CrashSequence(__null, 1558); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1559 MOZ_RELEASE_ASSERT(*otherValue == 42)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*otherValue == 42)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*otherValue == 42))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("*otherValue == 42"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1559); do {
} while (false); do { MOZ_CrashSequence(__null, 1559); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1560
1561 // Check that andThen can move the contained value.
1562 mayValue = Some(BasicValue(1));
1563 otherValue = std::move(mayValue).andThen([&](BasicValue&& aVal) {
1564 BasicValue tmp = std::move(aVal);
1565 return Some(tmp.GetTag());
1566 });
1567 MOZ_RELEASE_ASSERT(mayValue.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue.isNothing()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("mayValue.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1567); do {
} while (false); do { MOZ_CrashSequence(__null, 1567); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1568 MOZ_RELEASE_ASSERT(*otherValue == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*otherValue == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*otherValue == 1))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("*otherValue == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1568); do {
} while (false); do { MOZ_CrashSequence(__null, 1568); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1569
1570 return true;
1571}
1572
1573static bool TestOrElse() {
1574 const auto createValue = [&](int aTag) {
1575 return [&, aTag]() -> Maybe<BasicValue> {
1576 gFunctionWasApplied = true;
1577 return Some(BasicValue(aTag));
1578 };
1579 };
1580 // Check that orElse handles the 'Some' case.
1581 gFunctionWasApplied = false;
1582 Maybe<BasicValue> mayValue = Some(BasicValue(1));
1583 Maybe<BasicValue> otherValue = mayValue.orElse(createValue(2));
1584 MOZ_RELEASE_ASSERT(!gFunctionWasApplied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!gFunctionWasApplied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!gFunctionWasApplied))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("!gFunctionWasApplied"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1584); do {
} while (false); do { MOZ_CrashSequence(__null, 1584); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1585 MOZ_RELEASE_ASSERT(otherValue->GetTag() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(otherValue->GetTag() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(otherValue->GetTag() == 1
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"otherValue->GetTag() == 1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1585); do { } while (false); do { MOZ_CrashSequence(__null,
1585); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1586
1587 // Check that orElse handles the 'Nothing' case.
1588 mayValue = Nothing();
1589 otherValue = mayValue.orElse(createValue(1));
1590 MOZ_RELEASE_ASSERT(gFunctionWasApplied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(gFunctionWasApplied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(gFunctionWasApplied))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("gFunctionWasApplied"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1590); do {
} while (false); do { MOZ_CrashSequence(__null, 1590); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1591 MOZ_RELEASE_ASSERT(otherValue->GetTag() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(otherValue->GetTag() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(otherValue->GetTag() == 1
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"otherValue->GetTag() == 1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1591); do { } while (false); do { MOZ_CrashSequence(__null,
1591); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1592 gFunctionWasApplied = false;
1593 otherValue = otherValue.orElse(createValue(2));
1594 MOZ_RELEASE_ASSERT(!gFunctionWasApplied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!gFunctionWasApplied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!gFunctionWasApplied))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("!gFunctionWasApplied"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1594); do {
} while (false); do { MOZ_CrashSequence(__null, 1594); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1595 MOZ_RELEASE_ASSERT(otherValue->GetTag() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(otherValue->GetTag() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(otherValue->GetTag() == 1
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"otherValue->GetTag() == 1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1595); do { } while (false); do { MOZ_CrashSequence(__null,
1595); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1596
1597 // Check that orElse works with a const reference.
1598 mayValue = Nothing();
1599 const Maybe<BasicValue>& mayValueCRef = mayValue;
1600 gFunctionWasApplied = false;
1601 otherValue = mayValueCRef.orElse(createValue(1));
1602 MOZ_RELEASE_ASSERT(gFunctionWasApplied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(gFunctionWasApplied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(gFunctionWasApplied))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("gFunctionWasApplied"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1602); do {
} while (false); do { MOZ_CrashSequence(__null, 1602); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1603 MOZ_RELEASE_ASSERT(otherValue->GetTag() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(otherValue->GetTag() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(otherValue->GetTag() == 1
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"otherValue->GetTag() == 1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1603); do { } while (false); do { MOZ_CrashSequence(__null,
1603); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1604
1605 // Check that orElse works with functors.
1606 gFunctionWasApplied = false;
1607 AccessValueAndReturnOtherFunctor accesser(42);
1608 mayValue = Some(BasicValue(1));
1609 otherValue = mayValue.orElse(accesser);
1610 MOZ_RELEASE_ASSERT(!gFunctionWasApplied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!gFunctionWasApplied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!gFunctionWasApplied))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("!gFunctionWasApplied"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1610); do {
} while (false); do { MOZ_CrashSequence(__null, 1610); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1611 MOZ_RELEASE_ASSERT(mayValue->GetTag() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue->GetTag() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue->GetTag() == 1))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("mayValue->GetTag() == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1611); do {
} while (false); do { MOZ_CrashSequence(__null, 1611); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1612 MOZ_RELEASE_ASSERT(otherValue->GetTag() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(otherValue->GetTag() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(otherValue->GetTag() == 1
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"otherValue->GetTag() == 1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1612); do { } while (false); do { MOZ_CrashSequence(__null,
1612); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1613 mayValue = Nothing();
1614 otherValue = mayValue.orElse(accesser);
1615 MOZ_RELEASE_ASSERT(gFunctionWasApplied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(gFunctionWasApplied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(gFunctionWasApplied))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("gFunctionWasApplied"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1615); do {
} while (false); do { MOZ_CrashSequence(__null, 1615); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1616 MOZ_RELEASE_ASSERT(mayValue.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue.isNothing()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("mayValue.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1616); do {
} while (false); do { MOZ_CrashSequence(__null, 1616); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1617 MOZ_RELEASE_ASSERT(otherValue->GetTag() == 42)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(otherValue->GetTag() == 42)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(otherValue->GetTag() == 42
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"otherValue->GetTag() == 42", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1617); do { } while (false); do { MOZ_CrashSequence(__null,
1617); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1618
1619 // Check that orElse works with lambda expressions.
1620 gFunctionWasApplied = false;
1621 mayValue = Nothing();
1622 otherValue = mayValue.orElse([] { return Some(BasicValue(1)); });
1623 MOZ_RELEASE_ASSERT(otherValue->GetTag() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(otherValue->GetTag() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(otherValue->GetTag() == 1
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"otherValue->GetTag() == 1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1623); do { } while (false); do { MOZ_CrashSequence(__null,
1623); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1624 mayValue = otherValue.orElse([] { return Some(BasicValue(2)); });
1625 MOZ_RELEASE_ASSERT(mayValue->GetTag() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue->GetTag() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue->GetTag() == 1))
), 0))) { do { } while (false); MOZ_ReportAssertionFailure("mayValue->GetTag() == 1"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1625); do {
} while (false); do { MOZ_CrashSequence(__null, 1625); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1626 otherValue = mayValueCRef.orElse([&] {
1627 gFunctionWasApplied = true;
1628 return Some(BasicValue(42));
1629 });
1630 MOZ_RELEASE_ASSERT(!gFunctionWasApplied)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!gFunctionWasApplied)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!gFunctionWasApplied))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("!gFunctionWasApplied"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1630); do {
} while (false); do { MOZ_CrashSequence(__null, 1630); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1631 MOZ_RELEASE_ASSERT(otherValue->GetTag() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(otherValue->GetTag() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(otherValue->GetTag() == 1
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"otherValue->GetTag() == 1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1631); do { } while (false); do { MOZ_CrashSequence(__null,
1631); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1632
1633 // Check that orElse can move the contained value.
1634 mayValue = Some(BasicValue(1));
1635 otherValue = std::move(mayValue).orElse([] { return Some(BasicValue(2)); });
1636 MOZ_RELEASE_ASSERT(mayValue.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue.isNothing()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("mayValue.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1636); do {
} while (false); do { MOZ_CrashSequence(__null, 1636); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1637 MOZ_RELEASE_ASSERT(otherValue->GetTag() == 1)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(otherValue->GetTag() == 1)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(otherValue->GetTag() == 1
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"otherValue->GetTag() == 1", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1637); do { } while (false); do { MOZ_CrashSequence(__null,
1637); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1638
1639 return true;
1640}
1641
1642static bool TestComposedMoves() {
1643 const auto moveAlong = [](UncopyableValue&& aValue) {
1644 return Some(std::move(aValue));
1645 };
1646 const auto justNothing = []() -> Maybe<UncopyableValue> { return Nothing(); };
1647 const auto createValue = [] { return Some(UncopyableValue()); };
1648
1649 // Check that andThen and orElse can propagate a non-copyable value created
1650 // mid-chain.
1651 Maybe<UncopyableValue> mayValue;
1652 Maybe<UncopyableValue> movedValue = std::move(mayValue)
1653 .andThen(moveAlong)
1654 .orElse(createValue)
1655 .andThen(moveAlong);
1656 MOZ_RELEASE_ASSERT(mayValue.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue.isNothing()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("mayValue.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1656); do {
} while (false); do { MOZ_CrashSequence(__null, 1656); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1657 MOZ_RELEASE_ASSERT(movedValue->GetStatus() == eWasMoveConstructed)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(movedValue->GetStatus() == eWasMoveConstructed)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(movedValue->GetStatus() == eWasMoveConstructed)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("movedValue->GetStatus() == eWasMoveConstructed"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1657); do {
} while (false); do { MOZ_CrashSequence(__null, 1657); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1658
1659 // Check that andThen and orElse can propagate a non-copyable value created
1660 // pre-chain.
1661 mayValue = Some(UncopyableValue{});
1662 movedValue = std::move(mayValue)
1663 .andThen(moveAlong)
1664 .orElse(justNothing)
1665 .andThen(moveAlong);
1666 MOZ_RELEASE_ASSERT(mayValue.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mayValue.isNothing())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(mayValue.isNothing()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("mayValue.isNothing()"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1666); do {
} while (false); do { MOZ_CrashSequence(__null, 1666); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1667 MOZ_RELEASE_ASSERT(movedValue->GetStatus() == eWasMoveAssigned)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(movedValue->GetStatus() == eWasMoveAssigned)>::
isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(movedValue->GetStatus() == eWasMoveAssigned))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("movedValue->GetStatus() == eWasMoveAssigned"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1667); do {
} while (false); do { MOZ_CrashSequence(__null, 1667); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1668
1669 // Check that andThen and orElse can propagate a reference.
1670 {
1671 UncopyableValue val{};
1672 UncopyableValue otherVal{};
1673 const auto passAlong = [](UncopyableValue& aValue) {
1674 return SomeRef(aValue);
1675 };
1676 const auto fallbackToOther = [&]() { return SomeRef(otherVal); };
1677
1678 Maybe<UncopyableValue&> mayRef = SomeRef(val);
1679 Maybe<UncopyableValue&> chainedRef =
1680 mayRef.andThen(passAlong).orElse(fallbackToOther).andThen(passAlong);
1681 MOZ_RELEASE_ASSERT(&val != &otherVal,do { static_assert( mozilla::detail::AssertionConditionType<
decltype(&val != &otherVal)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(&val != &otherVal)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("&val != &otherVal"
" (" "Distinct values should not compare equal" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1682); do { } while (false); do { MOZ_CrashSequence(__null,
1682); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
1682 "Distinct values should not compare equal")do { static_assert( mozilla::detail::AssertionConditionType<
decltype(&val != &otherVal)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(&val != &otherVal)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("&val != &otherVal"
" (" "Distinct values should not compare equal" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1682); do { } while (false); do { MOZ_CrashSequence(__null,
1682); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1683 MOZ_RELEASE_ASSERT(&*mayRef == &*chainedRef,do { static_assert( mozilla::detail::AssertionConditionType<
decltype(&*mayRef == &*chainedRef)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(&*mayRef == &*chainedRef
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"&*mayRef == &*chainedRef" " (" "Chain should pass along the same reference"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1684); do
{ } while (false); do { MOZ_CrashSequence(__null, 1684); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
1684 "Chain should pass along the same reference")do { static_assert( mozilla::detail::AssertionConditionType<
decltype(&*mayRef == &*chainedRef)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(&*mayRef == &*chainedRef
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"&*mayRef == &*chainedRef" " (" "Chain should pass along the same reference"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1684); do
{ } while (false); do { MOZ_CrashSequence(__null, 1684); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1685 }
1686
1687 // Check that andThen and orElse can propagate a const reference.
1688 {
1689 const UncopyableValue val{};
1690 const UncopyableValue otherVal{};
1691 const auto passAlong = [](const UncopyableValue& aValue) {
1692 return SomeRef(aValue);
1693 };
1694 const auto fallbackToOther = [&]() { return SomeRef(otherVal); };
1695
1696 Maybe<const UncopyableValue&> mayRef = SomeRef(val);
1697 Maybe<const UncopyableValue&> chainedRef =
1698 mayRef.andThen(passAlong).orElse(fallbackToOther).andThen(passAlong);
1699 MOZ_RELEASE_ASSERT(&val != &otherVal,do { static_assert( mozilla::detail::AssertionConditionType<
decltype(&val != &otherVal)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(&val != &otherVal)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("&val != &otherVal"
" (" "Distinct values should not compare equal" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1700); do { } while (false); do { MOZ_CrashSequence(__null,
1700); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
1700 "Distinct values should not compare equal")do { static_assert( mozilla::detail::AssertionConditionType<
decltype(&val != &otherVal)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(&val != &otherVal)))
, 0))) { do { } while (false); MOZ_ReportAssertionFailure("&val != &otherVal"
" (" "Distinct values should not compare equal" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1700); do { } while (false); do { MOZ_CrashSequence(__null,
1700); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false)
;
1701 MOZ_RELEASE_ASSERT(&*mayRef == &*chainedRef,do { static_assert( mozilla::detail::AssertionConditionType<
decltype(&*mayRef == &*chainedRef)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(&*mayRef == &*chainedRef
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"&*mayRef == &*chainedRef" " (" "Chain should pass along the same reference"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1702); do
{ } while (false); do { MOZ_CrashSequence(__null, 1702); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
1702 "Chain should pass along the same reference")do { static_assert( mozilla::detail::AssertionConditionType<
decltype(&*mayRef == &*chainedRef)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(&*mayRef == &*chainedRef
))), 0))) { do { } while (false); MOZ_ReportAssertionFailure(
"&*mayRef == &*chainedRef" " (" "Chain should pass along the same reference"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1702); do
{ } while (false); do { MOZ_CrashSequence(__null, 1702); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1703 }
1704
1705 return true;
1706}
1707
1708static bool TestBeginEnd() {
1709 for ([[maybe_unused]] auto v : static_cast<Maybe<int>>(Nothing())) {
1710 MOZ_CRASH("Nothing should not be iterated")do { do { } while (false); MOZ_ReportCrash("" "Nothing should not be iterated"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1710); do {
} while (false); do { MOZ_CrashSequence(__null, 1710); __attribute__
((nomerge)) ::abort(); } while (false); } while (false)
;
1711 }
1712
1713 for (auto v : Some(42)) {
1714 MOZ_RELEASE_ASSERT(v == 42, "Some(42) should be iterated")do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v == 42)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v == 42))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v == 42" " (" "Some(42) should be iterated"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1714); do
{ } while (false); do { MOZ_CrashSequence(__null, 1714); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1715 }
1716
1717 Maybe<int> maybe;
1718 for ([[maybe_unused]] auto v : maybe) {
1719 MOZ_CRASH("Nothing should not be iterated")do { do { } while (false); MOZ_ReportCrash("" "Nothing should not be iterated"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1719); do {
} while (false); do { MOZ_CrashSequence(__null, 1719); __attribute__
((nomerge)) ::abort(); } while (false); } while (false)
;
1720 }
1721
1722 maybe = Some(42);
1723
1724 for (auto v : maybe) {
1725 MOZ_RELEASE_ASSERT(v == 42, "Some(42) should be iterated")do { static_assert( mozilla::detail::AssertionConditionType<
decltype(v == 42)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(v == 42))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("v == 42" " (" "Some(42) should be iterated"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1725); do
{ } while (false); do { MOZ_CrashSequence(__null, 1725); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1726 }
1727
1728 maybe = Nothing();
1729
1730 for ([[maybe_unused]] auto v : maybe) {
1731 MOZ_CRASH("Nothing should not be iterated")do { do { } while (false); MOZ_ReportCrash("" "Nothing should not be iterated"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1731); do {
} while (false); do { MOZ_CrashSequence(__null, 1731); __attribute__
((nomerge)) ::abort(); } while (false); } while (false)
;
1732 }
1733
1734 int v = 42;
1735 Maybe<int*> maybePtr;
1736 for ([[maybe_unused]] auto* v : maybePtr) {
1737 MOZ_CRASH("Nothing should not be iterated")do { do { } while (false); MOZ_ReportCrash("" "Nothing should not be iterated"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1737); do {
} while (false); do { MOZ_CrashSequence(__null, 1737); __attribute__
((nomerge)) ::abort(); } while (false); } while (false)
;
1738 }
1739
1740 maybePtr = Some(&v);
1741
1742 for (auto* v : maybePtr) {
1743 MOZ_RELEASE_ASSERT(*v == 42, "Some(address) should be iterated")do { static_assert( mozilla::detail::AssertionConditionType<
decltype(*v == 42)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(*v == 42))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("*v == 42" " (" "Some(address) should be iterated"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1743); do
{ } while (false); do { MOZ_CrashSequence(__null, 1743); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
1744 }
1745
1746 maybePtr = Nothing();
1747 for ([[maybe_unused]] auto* v : maybePtr) {
1748 MOZ_CRASH("Nothing should not be iterated")do { do { } while (false); MOZ_ReportCrash("" "Nothing should not be iterated"
, "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1748); do {
} while (false); do { MOZ_CrashSequence(__null, 1748); __attribute__
((nomerge)) ::abort(); } while (false); } while (false)
;
1749 }
1750
1751 return true;
1752}
1753
1754// These are quasi-implementation details, but we assert them here to prevent
1755// backsliding to earlier times when Maybe<T> for smaller T took up more space
1756// than T's alignment required.
1757
1758static_assert(sizeof(Maybe<char>) == 2 * sizeof(char),
1759 "Maybe<char> shouldn't bloat at all ");
1760static_assert(sizeof(Maybe<bool>) <= 2 * sizeof(bool),
1761 "Maybe<bool> shouldn't bloat");
1762static_assert(sizeof(Maybe<int>) <= 2 * sizeof(int),
1763 "Maybe<int> shouldn't bloat");
1764static_assert(sizeof(Maybe<long>) <= 2 * sizeof(long),
1765 "Maybe<long> shouldn't bloat");
1766static_assert(sizeof(Maybe<double>) <= 2 * sizeof(double),
1767 "Maybe<double> shouldn't bloat");
1768static_assert(sizeof(Maybe<int&>) == sizeof(int*));
1769
1770int main() {
1771 RUN_TEST(TestBasicFeatures)do { bool cond = (TestBasicFeatures()); do { static_assert( mozilla
::detail::AssertionConditionType<decltype(cond)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(cond))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("cond" " (" "Unexpectedly returned false during test: " "TestBasicFeatures"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1771); do
{ } while (false); do { MOZ_CrashSequence(__null, 1771); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); cond
= AllDestructorsWereCalled(); do { static_assert( mozilla::detail
::AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
"TestBasicFeatures" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1771); do { } while (false); do { MOZ_CrashSequence(__null,
1771); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false); } while (false)
;
1772 RUN_TEST(TestCopyAndMove)do { bool cond = (TestCopyAndMove()); do { static_assert( mozilla
::detail::AssertionConditionType<decltype(cond)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(cond))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("cond" " (" "Unexpectedly returned false during test: " "TestCopyAndMove"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1772); do
{ } while (false); do { MOZ_CrashSequence(__null, 1772); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); cond
= AllDestructorsWereCalled(); do { static_assert( mozilla::detail
::AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
"TestCopyAndMove" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1772); do { } while (false); do { MOZ_CrashSequence(__null,
1772); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false); } while (false)
;
1773 RUN_TEST(TestFunctionalAccessors)do { bool cond = (TestFunctionalAccessors()); do { static_assert
( mozilla::detail::AssertionConditionType<decltype(cond)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(cond))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("cond" " (" "Unexpectedly returned false during test: " "TestFunctionalAccessors"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1773); do
{ } while (false); do { MOZ_CrashSequence(__null, 1773); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); cond
= AllDestructorsWereCalled(); do { static_assert( mozilla::detail
::AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
"TestFunctionalAccessors" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1773); do { } while (false); do { MOZ_CrashSequence(__null,
1773); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false); } while (false)
;
1774 RUN_TEST(TestApply)do { bool cond = (TestApply()); do { static_assert( mozilla::
detail::AssertionConditionType<decltype(cond)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(cond))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("cond" " (" "Unexpectedly returned false during test: " "TestApply"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1774); do
{ } while (false); do { MOZ_CrashSequence(__null, 1774); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); cond
= AllDestructorsWereCalled(); do { static_assert( mozilla::detail
::AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
"TestApply" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1774); do { } while (false); do { MOZ_CrashSequence(__null,
1774); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false); } while (false)
;
1775 RUN_TEST(TestMap)do { bool cond = (TestMap()); do { static_assert( mozilla::detail
::AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Unexpectedly returned false during test: "
"TestMap" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1775); do { } while (false); do { MOZ_CrashSequence(__null,
1775); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false); cond = AllDestructorsWereCalled(); do { static_assert
( mozilla::detail::AssertionConditionType<decltype(cond)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(cond))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("cond" " (" "Failed to destroy all objects during test: " "TestMap"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1775); do
{ } while (false); do { MOZ_CrashSequence(__null, 1775); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); } while
(false)
;
1776 RUN_TEST(TestToMaybe)do { bool cond = (TestToMaybe()); do { static_assert( mozilla
::detail::AssertionConditionType<decltype(cond)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(cond))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("cond" " (" "Unexpectedly returned false during test: " "TestToMaybe"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1776); do
{ } while (false); do { MOZ_CrashSequence(__null, 1776); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); cond
= AllDestructorsWereCalled(); do { static_assert( mozilla::detail
::AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
"TestToMaybe" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1776); do { } while (false); do { MOZ_CrashSequence(__null,
1776); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false); } while (false)
;
1777 RUN_TEST(TestComparisonOperators)do { bool cond = (TestComparisonOperators()); do { static_assert
( mozilla::detail::AssertionConditionType<decltype(cond)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(cond))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("cond" " (" "Unexpectedly returned false during test: " "TestComparisonOperators"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1777); do
{ } while (false); do { MOZ_CrashSequence(__null, 1777); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); cond
= AllDestructorsWereCalled(); do { static_assert( mozilla::detail
::AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
"TestComparisonOperators" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1777); do { } while (false); do { MOZ_CrashSequence(__null,
1777); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false); } while (false)
;
1778 RUN_TEST(TestVirtualFunction)do { bool cond = (TestVirtualFunction()); do { static_assert(
mozilla::detail::AssertionConditionType<decltype(cond)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(cond))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("cond" " (" "Unexpectedly returned false during test: " "TestVirtualFunction"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1778); do
{ } while (false); do { MOZ_CrashSequence(__null, 1778); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); cond
= AllDestructorsWereCalled(); do { static_assert( mozilla::detail
::AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
"TestVirtualFunction" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1778); do { } while (false); do { MOZ_CrashSequence(__null,
1778); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false); } while (false)
;
1779 RUN_TEST(TestSomeNullptrConversion)do { bool cond = (TestSomeNullptrConversion()); do { static_assert
( mozilla::detail::AssertionConditionType<decltype(cond)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(cond))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("cond" " (" "Unexpectedly returned false during test: " "TestSomeNullptrConversion"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1779); do
{ } while (false); do { MOZ_CrashSequence(__null, 1779); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); cond
= AllDestructorsWereCalled(); do { static_assert( mozilla::detail
::AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
"TestSomeNullptrConversion" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1779); do { } while (false); do { MOZ_CrashSequence(__null,
1779); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false); } while (false)
;
1780 RUN_TEST(TestSomePointerConversion)do { bool cond = (TestSomePointerConversion()); do { static_assert
( mozilla::detail::AssertionConditionType<decltype(cond)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(cond))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("cond" " (" "Unexpectedly returned false during test: " "TestSomePointerConversion"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1780); do
{ } while (false); do { MOZ_CrashSequence(__null, 1780); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); cond
= AllDestructorsWereCalled(); do { static_assert( mozilla::detail
::AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
"TestSomePointerConversion" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1780); do { } while (false); do { MOZ_CrashSequence(__null,
1780); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false); } while (false)
;
1781 RUN_TEST(TestTypeConversion)do { bool cond = (TestTypeConversion()); do { static_assert( mozilla
::detail::AssertionConditionType<decltype(cond)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(cond))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("cond" " (" "Unexpectedly returned false during test: " "TestTypeConversion"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1781); do
{ } while (false); do { MOZ_CrashSequence(__null, 1781); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); cond
= AllDestructorsWereCalled(); do { static_assert( mozilla::detail
::AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
"TestTypeConversion" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1781); do { } while (false); do { MOZ_CrashSequence(__null,
1781); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false); } while (false)
;
1782 RUN_TEST(TestReference)do { bool cond = (TestReference()); do { static_assert( mozilla
::detail::AssertionConditionType<decltype(cond)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(cond))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("cond" " (" "Unexpectedly returned false during test: " "TestReference"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1782); do
{ } while (false); do { MOZ_CrashSequence(__null, 1782); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); cond
= AllDestructorsWereCalled(); do { static_assert( mozilla::detail
::AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
"TestReference" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1782); do { } while (false); do { MOZ_CrashSequence(__null,
1782); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false); } while (false)
;
1783 RUN_TEST(TestAndThen)do { bool cond = (TestAndThen()); do { static_assert( mozilla
::detail::AssertionConditionType<decltype(cond)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(cond))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("cond" " (" "Unexpectedly returned false during test: " "TestAndThen"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1783); do
{ } while (false); do { MOZ_CrashSequence(__null, 1783); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); cond
= AllDestructorsWereCalled(); do { static_assert( mozilla::detail
::AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
"TestAndThen" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1783); do { } while (false); do { MOZ_CrashSequence(__null,
1783); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false); } while (false)
;
1784 RUN_TEST(TestOrElse)do { bool cond = (TestOrElse()); do { static_assert( mozilla::
detail::AssertionConditionType<decltype(cond)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(cond))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("cond" " (" "Unexpectedly returned false during test: " "TestOrElse"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1784); do
{ } while (false); do { MOZ_CrashSequence(__null, 1784); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); cond
= AllDestructorsWereCalled(); do { static_assert( mozilla::detail
::AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
"TestOrElse" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1784); do { } while (false); do { MOZ_CrashSequence(__null,
1784); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false); } while (false)
;
1785 RUN_TEST(TestComposedMoves)do { bool cond = (TestComposedMoves()); do { static_assert( mozilla
::detail::AssertionConditionType<decltype(cond)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(cond))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("cond" " (" "Unexpectedly returned false during test: " "TestComposedMoves"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1785); do
{ } while (false); do { MOZ_CrashSequence(__null, 1785); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); cond
= AllDestructorsWereCalled(); do { static_assert( mozilla::detail
::AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
"TestComposedMoves" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1785); do { } while (false); do { MOZ_CrashSequence(__null,
1785); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false); } while (false)
;
1786 RUN_TEST(TestBeginEnd)do { bool cond = (TestBeginEnd()); do { static_assert( mozilla
::detail::AssertionConditionType<decltype(cond)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(cond))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("cond" " (" "Unexpectedly returned false during test: " "TestBeginEnd"
")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp", 1786); do
{ } while (false); do { MOZ_CrashSequence(__null, 1786); __attribute__
((nomerge)) ::abort(); } while (false); } } while (false); cond
= AllDestructorsWereCalled(); do { static_assert( mozilla::detail
::AssertionConditionType<decltype(cond)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(cond))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("cond" " (" "Failed to destroy all objects during test: "
"TestBeginEnd" ")", "/root/firefox-clang/mfbt/tests/TestMaybe.cpp"
, 1786); do { } while (false); do { MOZ_CrashSequence(__null,
1786); __attribute__((nomerge)) ::abort(); } while (false); }
} while (false); } while (false)
;
1787
1788 return 0;
1789}