Bug 1732219 - Add API for fetching the preview image. r=geckoview-reviewers,agi,mconley
[gecko.git] / mfbt / tests / TestTypeTraits.cpp
blob4e945c7a8aed5515d06a3bb1d6c43fbcb4d74de8
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include <type_traits>
9 #include "mozilla/Assertions.h"
10 #include "mozilla/TypeTraits.h"
12 using mozilla::IsDestructible;
14 class PublicDestructible {
15 public:
16 ~PublicDestructible();
18 class PrivateDestructible {
19 private:
20 ~PrivateDestructible();
22 class TrivialDestructible {};
24 static_assert(IsDestructible<PublicDestructible>::value,
25 "public destructible class is destructible");
26 static_assert(!IsDestructible<PrivateDestructible>::value,
27 "private destructible class is not destructible");
28 static_assert(IsDestructible<TrivialDestructible>::value,
29 "trivial destructible class is destructible");
32 * Android's broken [u]intptr_t inttype macros are broken because its PRI*PTR
33 * macros are defined as "ld", but sizeof(long) is 8 and sizeof(intptr_t)
34 * is 4 on 32-bit Android. We redefine Android's PRI*PTR macros in
35 * IntegerPrintfMacros.h and assert here that our new definitions match the
36 * actual type sizes seen at compile time.
38 #if defined(ANDROID) && !defined(__LP64__)
39 static_assert(std::is_same_v<int, intptr_t>,
40 "emulated PRI[di]PTR definitions will be wrong");
41 static_assert(std::is_same_v<unsigned int, uintptr_t>,
42 "emulated PRI[ouxX]PTR definitions will be wrong");
43 #endif
45 int main() { return 0; }