nothrow_t.fail.cpp 820 B

123456789101112131415161718192021222324252627282930
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is dual licensed under the MIT and the University of Illinois Open
  6. // Source Licenses. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // UNSUPPORTED: c++98, c++03
  10. // Before GCC 6, aggregate initialization kicks in.
  11. // See https://stackoverflow.com/q/41799015/627587.
  12. // UNSUPPORTED: gcc-5
  13. // struct nothrow_t {
  14. // explicit nothrow_t() = default;
  15. // };
  16. // extern const nothrow_t nothrow;
  17. // This test checks for LWG 2510.
  18. #include <new>
  19. std::nothrow_t f() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
  20. int main(int, char**) {
  21. return 0;
  22. }