c1xx_broken_is_trivially_copyable.pass.cpp 901 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. // UNSUPPORTED: c++98, c++03
  9. // Verify TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE.
  10. #include <type_traits>
  11. #include "test_macros.h"
  12. #include "test_workarounds.h"
  13. struct S {
  14. S(S const&) = default;
  15. S(S&&) = default;
  16. S& operator=(S const&) = delete;
  17. S& operator=(S&&) = delete;
  18. };
  19. int main(int, char**) {
  20. #if defined(TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE)
  21. static_assert(!std::is_trivially_copyable<S>::value, "");
  22. #else
  23. static_assert(std::is_trivially_copyable<S>::value, "");
  24. #endif
  25. return 0;
  26. }