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//===----------------------------------------------------------------------===//
8
9// <stack>
10
11// void swap(stack& c)
12// noexcept(__is_nothrow_swappable<container_type>::value);
13
14// This tests a conforming extension
15
16// UNSUPPORTED: c++03
17
18#include <stack>
19#include <utility>
20#include <cassert>
21
22#include "test_macros.h"
23#include "MoveOnly.h"
24
25int main(int, char**)
26{
27 {
28 typedef std::stack<MoveOnly> C;
29 static_assert(noexcept(swap(a&: std::declval<C&>(), b&: std::declval<C&>())), "");
30 }
31
32 return 0;
33}
34

source code of libcxx/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp