swap_noexcept.pass.cpp 816 B

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