Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / containers / container.adaptors / stack / stack.cons / ctor_rcontainer.pass.cpp
blob56dc40e4ed86bc58c73c83b89031f46d1ead06b3
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 // UNSUPPORTED: c++03
11 // <stack>
13 // explicit stack(Container&&= Container()); // before C++20
14 // stack() : stack(Container()) {} // C++20
15 // explicit stack(Container&&); // C++20
17 #include <stack>
18 #include <cassert>
20 #include "test_macros.h"
21 #include "MoveOnly.h"
22 #if TEST_STD_VER >= 11
23 #include "test_convertible.h"
24 #endif
26 template <class C>
28 make(int n)
30 C c;
31 for (int i = 0; i < n; ++i)
32 c.push_back(MoveOnly(i));
33 return c;
36 int main(int, char**)
38 typedef std::deque<MoveOnly> Container;
39 typedef std::stack<MoveOnly> Q;
40 Q q(make<Container>(5));
41 assert(q.size() == 5);
43 #if TEST_STD_VER >= 11
44 static_assert(!test_convertible<Q, Container&&>(), "");
45 #endif
47 return 0;