xref: /llvm-project/libcxx/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp (revision 31cbe0f240f660f15602c96b787c58a26f17e179)
15a83710eSEric Fiselier //===----------------------------------------------------------------------===//
25a83710eSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65a83710eSEric Fiselier //
75a83710eSEric Fiselier //===----------------------------------------------------------------------===//
85a83710eSEric Fiselier 
95a83710eSEric Fiselier // <stack>
105a83710eSEric Fiselier 
115a83710eSEric Fiselier // void swap(stack& c)
125a83710eSEric Fiselier //     noexcept(__is_nothrow_swappable<container_type>::value);
135a83710eSEric Fiselier 
145a83710eSEric Fiselier // This tests a conforming extension
155a83710eSEric Fiselier 
16*31cbe0f2SLouis Dionne // UNSUPPORTED: c++03
17f2f2a639SEric Fiselier 
185a83710eSEric Fiselier #include <stack>
192cd516e0SEric Fiselier #include <utility>
205a83710eSEric Fiselier #include <cassert>
215a83710eSEric Fiselier 
227fc6a556SMarshall Clow #include "test_macros.h"
23949389c3SMarshall Clow #include "MoveOnly.h"
245a83710eSEric Fiselier 
main(int,char **)252df59c50SJF Bastien int main(int, char**)
265a83710eSEric Fiselier {
275a83710eSEric Fiselier     {
285a83710eSEric Fiselier         typedef std::stack<MoveOnly> C;
292cd516e0SEric Fiselier         static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
305a83710eSEric Fiselier     }
312df59c50SJF Bastien 
322df59c50SJF Bastien   return 0;
335a83710eSEric Fiselier }
34