diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2017-11-22 19:49:03 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2017-11-22 19:49:03 +0000 |
commit | 9180eb1f4ab96481413e93d35f35c3685de3084c (patch) | |
tree | cd567a3da8ebf76d616d8dbc2ea2111ae725409c /libcxx/test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp | |
parent | 374cff69e0c54989e8e8a7426b74b0b248c4885d (diff) | |
download | bcm5719-llvm-9180eb1f4ab96481413e93d35f35c3685de3084c.tar.gz bcm5719-llvm-9180eb1f4ab96481413e93d35f35c3685de3084c.zip |
Implement p0137r1 - std::launder. Reviewed as https://reviews.llvm.org/D40144
llvm-svn: 318864
Diffstat (limited to 'libcxx/test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp')
-rw-r--r-- | libcxx/test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libcxx/test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp b/libcxx/test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp new file mode 100644 index 00000000000..1c75e561d7c --- /dev/null +++ b/libcxx/test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp @@ -0,0 +1,27 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <new> + +// template <class T> constexpr T* launder(T* p) noexcept; + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 + +#include <new> +#include <cassert> + +#include "test_macros.h" + +int main () +{ + int *p = nullptr; + std::launder(p); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} |