Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / utilities / utility / pairs / pairs.pair / ctor.default.pass.cpp
blobdc05a2b4885943379e063eadf25c08f8e65b22d9
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <utility>
11 // template <class T1, class T2> struct pair
13 // explicit(see-below) constexpr pair();
15 // NOTE: The SFINAE on the default constructor is tested in
16 // default-sfinae.pass.cpp
19 #include <utility>
20 #include <type_traits>
21 #include <cassert>
23 #include "test_macros.h"
24 #include "archetypes.h"
26 int main(int, char**)
29 typedef std::pair<float, short*> P;
30 P p;
31 assert(p.first == 0.0f);
32 assert(p.second == nullptr);
34 #if TEST_STD_VER >= 11
36 typedef std::pair<float, short*> P;
37 constexpr P p;
38 static_assert(p.first == 0.0f, "");
39 static_assert(p.second == nullptr, "");
42 using NoDefault = ImplicitTypes::NoDefault;
43 using P = std::pair<int, NoDefault>;
44 static_assert(!std::is_default_constructible<P>::value, "");
45 using P2 = std::pair<NoDefault, int>;
46 static_assert(!std::is_default_constructible<P2>::value, "");
49 struct Base { };
50 struct Derived : Base { protected: Derived() = default; };
51 static_assert(!std::is_default_constructible<std::pair<Derived, int> >::value, "");
53 #endif
55 return 0;