From 25a7ba4524219e7eeb1254db0d406448f3703d3a Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 15 Nov 2017 20:02:27 +0000 Subject: More of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in string, string_view, and the free function std::empty(). Removed tabs from , which is why the diff is so big. llvm-svn: 318328 --- .../iterator.container/empty.container.fail.cpp | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 libcxx/test/std/iterators/iterator.container/empty.container.fail.cpp (limited to 'libcxx/test/std/iterators/iterator.container/empty.container.fail.cpp') diff --git a/libcxx/test/std/iterators/iterator.container/empty.container.fail.cpp b/libcxx/test/std/iterators/iterator.container/empty.container.fail.cpp new file mode 100644 index 00000000000..1773b53e7b1 --- /dev/null +++ b/libcxx/test/std/iterators/iterator.container/empty.container.fail.cpp @@ -0,0 +1,28 @@ +// -*- 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. +// +//===----------------------------------------------------------------------===// + +// + +// +// template constexpr auto empty(const C& c) -> decltype(c.empty()); + +// 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 +#include + +#include "test_macros.h" + +int main () +{ + std::vector c; + std::empty(c); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} -- cgit v1.2.3