diff options
Diffstat (limited to 'libcxx/test/std/language.support')
-rw-r--r-- | libcxx/test/std/language.support/support.dynamic/nothrow_t.fail.cpp | 30 | ||||
-rw-r--r-- | libcxx/test/std/language.support/support.dynamic/nothrow_t.pass.cpp | 23 |
2 files changed, 53 insertions, 0 deletions
diff --git a/libcxx/test/std/language.support/support.dynamic/nothrow_t.fail.cpp b/libcxx/test/std/language.support/support.dynamic/nothrow_t.fail.cpp new file mode 100644 index 00000000000..78ab087c3ea --- /dev/null +++ b/libcxx/test/std/language.support/support.dynamic/nothrow_t.fail.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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// Before GCC 6, aggregate initialization kicks in. +// See https://stackoverflow.com/q/41799015/627587. +// UNSUPPORTED: gcc-5 + +// struct nothrow_t { +// explicit nothrow_t() = default; +// }; +// extern const nothrow_t nothrow; + +// This test checks for LWG 2510. + +#include <new> + + +std::nothrow_t f() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}} + +int main(int, char**) { + return 0; +} diff --git a/libcxx/test/std/language.support/support.dynamic/nothrow_t.pass.cpp b/libcxx/test/std/language.support/support.dynamic/nothrow_t.pass.cpp new file mode 100644 index 00000000000..3a6231329f0 --- /dev/null +++ b/libcxx/test/std/language.support/support.dynamic/nothrow_t.pass.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// struct nothrow_t { +// explicit nothrow_t() = default; +// }; +// extern const nothrow_t nothrow; + +#include <new> + + +int main(int, char**) { + std::nothrow_t x = std::nothrow; + (void)x; + + return 0; +} |