diff options
| author | Howard Hinnant <hhinnant@apple.com> | 2011-06-04 22:09:19 +0000 |
|---|---|---|
| committer | Howard Hinnant <hhinnant@apple.com> | 2011-06-04 22:09:19 +0000 |
| commit | bd0c16007845678801199bd397d822b05b8ad2dd (patch) | |
| tree | f99928da54aa1e6444648aa1bf1ae88947222fa2 /libcxx/test/containers | |
| parent | c2ed270c0f31ea8a7bcfbce431b4b3570bbc3b4d (diff) | |
| download | bcm5719-llvm-bd0c16007845678801199bd397d822b05b8ad2dd.tar.gz bcm5719-llvm-bd0c16007845678801199bd397d822b05b8ad2dd.zip | |
noexcept for <stack>. This completes noexcept for Chapter 23 [containers].
llvm-svn: 132652
Diffstat (limited to 'libcxx/test/containers')
5 files changed, 148 insertions, 0 deletions
diff --git a/libcxx/test/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp b/libcxx/test/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp new file mode 100644 index 00000000000..521d9567758 --- /dev/null +++ b/libcxx/test/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <stack> + +// stack() +// noexcept(is_nothrow_default_constructible<container_type>::value); + +// This tests a conforming extension + +#include <stack> +#include <cassert> + +#include "../../../MoveOnly.h" + +int main() +{ +#if __has_feature(cxx_noexcept) + { + typedef std::stack<MoveOnly> C; + static_assert(std::is_nothrow_default_constructible<C>::value, ""); + } +#endif +} diff --git a/libcxx/test/containers/container.adaptors/stack/stack.cons/dtor_noexcept.pass.cpp b/libcxx/test/containers/container.adaptors/stack/stack.cons/dtor_noexcept.pass.cpp new file mode 100644 index 00000000000..c502012c8eb --- /dev/null +++ b/libcxx/test/containers/container.adaptors/stack/stack.cons/dtor_noexcept.pass.cpp @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <stack> + +// ~stack() // implied noexcept; + +#include <stack> +#include <cassert> + +#include "../../../MoveOnly.h" + +int main() +{ +#if __has_feature(cxx_noexcept) + { + typedef std::stack<MoveOnly> C; + static_assert(std::is_nothrow_destructible<C>::value, ""); + } +#endif +} diff --git a/libcxx/test/containers/container.adaptors/stack/stack.cons/move_assign_noexcept.pass.cpp b/libcxx/test/containers/container.adaptors/stack/stack.cons/move_assign_noexcept.pass.cpp new file mode 100644 index 00000000000..4952803d042 --- /dev/null +++ b/libcxx/test/containers/container.adaptors/stack/stack.cons/move_assign_noexcept.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <stack> + +// stack& operator=(stack&& c) +// noexcept(is_nothrow_move_assignable<container_type>::value); + +// This tests a conforming extension + +#include <stack> +#include <cassert> + +#include "../../../MoveOnly.h" + +int main() +{ +#if __has_feature(cxx_noexcept) + { + typedef std::stack<MoveOnly> C; + static_assert(std::is_nothrow_move_assignable<C>::value, ""); + } +#endif +} diff --git a/libcxx/test/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp b/libcxx/test/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp new file mode 100644 index 00000000000..c9826834311 --- /dev/null +++ b/libcxx/test/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <stack> + +// stack(stack&&) +// noexcept(is_nothrow_move_constructible<container_type>::value); + +// This tests a conforming extension + +#include <stack> +#include <cassert> + +#include "../../../MoveOnly.h" + +int main() +{ +#if __has_feature(cxx_noexcept) + { + typedef std::stack<MoveOnly> C; + static_assert(std::is_nothrow_move_constructible<C>::value, ""); + } +#endif +} diff --git a/libcxx/test/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp b/libcxx/test/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp new file mode 100644 index 00000000000..d0977f4e3e5 --- /dev/null +++ b/libcxx/test/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <stack> + +// void swap(stack& c) +// noexcept(__is_nothrow_swappable<container_type>::value); + +// This tests a conforming extension + +#include <stack> +#include <cassert> + +#include "../../../MoveOnly.h" + +int main() +{ +#if __has_feature(cxx_noexcept) + { + typedef std::stack<MoveOnly> C; + C c1, c2; + static_assert(noexcept(swap(c1, c2)), ""); + } +#endif +} |

