diff --git a/include/array b/include/array index 12780992e..4eb2fe6fc 100644 --- a/include/array +++ b/include/array @@ -183,7 +183,7 @@ struct _LIBCPP_TEMPLATE_VIS array _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;} // element access: diff --git a/include/deque b/include/deque index fee75614b..08cb29540 100644 --- a/include/deque +++ b/include/deque @@ -1314,7 +1314,7 @@ public: void resize(size_type __n); void resize(size_type __n, const value_type& __v); void shrink_to_fit() _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __base::size() == 0;} // element access: diff --git a/include/forward_list b/include/forward_list index 8bfa9a084..7b8204137 100644 --- a/include/forward_list +++ b/include/forward_list @@ -728,7 +728,7 @@ public: const_iterator cbefore_begin() const _NOEXCEPT {return const_iterator(base::__before_begin());} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return base::__before_begin()->__next_ == nullptr;} _LIBCPP_INLINE_VISIBILITY diff --git a/include/list b/include/list index 857d8a7a0..32e9a27bd 100644 --- a/include/list +++ b/include/list @@ -896,7 +896,7 @@ public: _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return base::__sz();} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return base::empty();} _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT diff --git a/include/map b/include/map index 71f18693f..952149389 100644 --- a/include/map +++ b/include/map @@ -1012,7 +1012,7 @@ public: _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const _NOEXCEPT {return rend();} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __tree_.size() == 0;} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __tree_.size();} @@ -1669,7 +1669,7 @@ public: _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const _NOEXCEPT {return rend();} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __tree_.size() == 0;} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __tree_.size();} diff --git a/include/queue b/include/queue index feaae8920..670fbb722 100644 --- a/include/queue +++ b/include/queue @@ -268,7 +268,7 @@ public: #endif // _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} _LIBCPP_INLINE_VISIBILITY size_type size() const {return c.size();} @@ -490,7 +490,7 @@ public: _Alloc>::value>::type* = 0); #endif // _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} _LIBCPP_INLINE_VISIBILITY size_type size() const {return c.size();} diff --git a/include/set b/include/set index 30f2fa88f..b4c6b2ef8 100644 --- a/include/set +++ b/include/set @@ -575,7 +575,7 @@ public: _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const _NOEXCEPT {return rend();} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __tree_.size() == 0;} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __tree_.size();} @@ -984,7 +984,7 @@ public: _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const _NOEXCEPT {return rend();} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __tree_.size() == 0;} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __tree_.size();} diff --git a/include/stack b/include/stack index b2d4e2395..0cb4c6ca9 100644 --- a/include/stack +++ b/include/stack @@ -181,7 +181,7 @@ public: : c(_VSTD::move(__s.c), __a) {} #endif // _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} _LIBCPP_INLINE_VISIBILITY size_type size() const {return c.size();} diff --git a/include/unordered_map b/include/unordered_map index 0546c0e2f..725cb6af2 100644 --- a/include/unordered_map +++ b/include/unordered_map @@ -885,7 +885,7 @@ public: allocator_type get_allocator() const _NOEXCEPT {return allocator_type(__table_.__node_alloc());} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __table_.size() == 0;} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __table_.size();} @@ -1634,7 +1634,7 @@ public: allocator_type get_allocator() const _NOEXCEPT {return allocator_type(__table_.__node_alloc());} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __table_.size() == 0;} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __table_.size();} diff --git a/include/unordered_set b/include/unordered_set index a14fb0004..3ae024a45 100644 --- a/include/unordered_set +++ b/include/unordered_set @@ -450,7 +450,7 @@ public: allocator_type get_allocator() const _NOEXCEPT {return allocator_type(__table_.__node_alloc());} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __table_.size() == 0;} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __table_.size();} @@ -968,7 +968,7 @@ public: allocator_type get_allocator() const _NOEXCEPT {return allocator_type(__table_.__node_alloc());} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __table_.size() == 0;} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __table_.size();} diff --git a/include/vector b/include/vector index b2f8f092c..54b1e8831 100644 --- a/include/vector +++ b/include/vector @@ -634,7 +634,7 @@ public: _LIBCPP_INLINE_VISIBILITY size_type capacity() const _NOEXCEPT {return __base::capacity();} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return this->__begin_ == this->__end_;} size_type max_size() const _NOEXCEPT; @@ -2290,7 +2290,7 @@ public: _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __size_;} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __size_ == 0;} void reserve(size_type __n); diff --git a/test/std/containers/associative/map/map.access/empty.fail.cpp b/test/std/containers/associative/map/map.access/empty.fail.cpp new file mode 100644 index 000000000..14ac13c99 --- /dev/null +++ b/test/std/containers/associative/map/map.access/empty.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. +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// bool empty() const 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 + +#include "test_macros.h" + +int main () +{ + std::map c; + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/containers/associative/multimap/empty.fail.cpp b/test/std/containers/associative/multimap/empty.fail.cpp new file mode 100644 index 000000000..12ca05ef1 --- /dev/null +++ b/test/std/containers/associative/multimap/empty.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. +// +//===----------------------------------------------------------------------===// + +// + +// class multimap + +// bool empty() const 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 + +#include "test_macros.h" + +int main () +{ + std::multimap c; + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/containers/associative/multiset/empty.fail.cpp b/test/std/containers/associative/multiset/empty.fail.cpp new file mode 100644 index 000000000..2169a07e4 --- /dev/null +++ b/test/std/containers/associative/multiset/empty.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. +// +//===----------------------------------------------------------------------===// + +// + +// class multiset + +// bool empty() const 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 + +#include "test_macros.h" + +int main () +{ + std::multiset c; + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/containers/associative/set/empty.fail.cpp b/test/std/containers/associative/set/empty.fail.cpp new file mode 100644 index 000000000..0eea6fb67 --- /dev/null +++ b/test/std/containers/associative/set/empty.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. +// +//===----------------------------------------------------------------------===// + +// + +// class set + +// bool empty() const 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 + +#include "test_macros.h" + +int main () +{ + std::set c; + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.fail.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.fail.cpp new file mode 100644 index 000000000..c034f22b7 --- /dev/null +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.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. +// +//===----------------------------------------------------------------------===// + +// + +// class priority_queue + +// bool empty() const 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 + +#include "test_macros.h" + +int main () +{ + std::priority_queue c; + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/containers/container.adaptors/queue/queue.defn/empty.fail.cpp b/test/std/containers/container.adaptors/queue/queue.defn/empty.fail.cpp new file mode 100644 index 000000000..ce017d2dd --- /dev/null +++ b/test/std/containers/container.adaptors/queue/queue.defn/empty.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. +// +//===----------------------------------------------------------------------===// + +// + +// class queue + +// bool empty() const 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 + +#include "test_macros.h" + +int main () +{ + std::queue c; + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/containers/container.adaptors/stack/stack.defn/empty.fail.cpp b/test/std/containers/container.adaptors/stack/stack.defn/empty.fail.cpp new file mode 100644 index 000000000..001a38fe3 --- /dev/null +++ b/test/std/containers/container.adaptors/stack/stack.defn/empty.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. +// +//===----------------------------------------------------------------------===// + +// + +// class stack + +// bool empty() const 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 + +#include "test_macros.h" + +int main () +{ + std::stack c; + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/containers/sequences/array/empty.fail.cpp b/test/std/containers/sequences/array/empty.fail.cpp new file mode 100644 index 000000000..85bf5a7c9 --- /dev/null +++ b/test/std/containers/sequences/array/empty.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. +// +//===----------------------------------------------------------------------===// + +// + +// class array + +// bool empty() const 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 + +#include "test_macros.h" + +int main () +{ + std::array c; + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/containers/sequences/deque/deque.capacity/empty.fail.cpp b/test/std/containers/sequences/deque/deque.capacity/empty.fail.cpp new file mode 100644 index 000000000..adfd5f2d8 --- /dev/null +++ b/test/std/containers/sequences/deque/deque.capacity/empty.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. +// +//===----------------------------------------------------------------------===// + +// + +// class deque + +// bool empty() const 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 + +#include "test_macros.h" + +int main () +{ + std::deque c; + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/containers/sequences/forwardlist/empty.fail.cpp b/test/std/containers/sequences/forwardlist/empty.fail.cpp new file mode 100644 index 000000000..78928b480 --- /dev/null +++ b/test/std/containers/sequences/forwardlist/empty.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. +// +//===----------------------------------------------------------------------===// + +// + +// class forward_list + +// bool empty() const 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 + +#include "test_macros.h" + +int main () +{ + std::forward_list c; + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/containers/sequences/list/list.capacity/empty.fail.cpp b/test/std/containers/sequences/list/list.capacity/empty.fail.cpp new file mode 100644 index 000000000..fe0387c83 --- /dev/null +++ b/test/std/containers/sequences/list/list.capacity/empty.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. +// +//===----------------------------------------------------------------------===// + +// + +// class list + +// bool empty() const 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 + +#include "test_macros.h" + +int main () +{ + std::list c; + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/containers/sequences/vector.bool/empty.fail.cpp b/test/std/containers/sequences/vector.bool/empty.fail.cpp new file mode 100644 index 000000000..99c245d0c --- /dev/null +++ b/test/std/containers/sequences/vector.bool/empty.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. +// +//===----------------------------------------------------------------------===// + +// + +// class vector + +// bool empty() const 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 + +#include "test_macros.h" + +int main () +{ + std::vector c; + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/containers/sequences/vector/vector.capacity/empty.fail.cpp b/test/std/containers/sequences/vector/vector.capacity/empty.fail.cpp new file mode 100644 index 000000000..abfdfbfb9 --- /dev/null +++ b/test/std/containers/sequences/vector/vector.capacity/empty.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. +// +//===----------------------------------------------------------------------===// + +// + +// class vector + +// bool empty() const 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 + +#include "test_macros.h" + +int main () +{ + std::vector c; + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/containers/unord/unord.map/empty.fail.cpp b/test/std/containers/unord/unord.map/empty.fail.cpp new file mode 100644 index 000000000..1c67169bb --- /dev/null +++ b/test/std/containers/unord/unord.map/empty.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. +// +//===----------------------------------------------------------------------===// + +// + +// class unordered_map + +// bool empty() const 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 + +#include "test_macros.h" + +int main () +{ + std::unordered_map c; + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/containers/unord/unord.multimap/empty.fail.cpp b/test/std/containers/unord/unord.multimap/empty.fail.cpp new file mode 100644 index 000000000..7e3a6f4b9 --- /dev/null +++ b/test/std/containers/unord/unord.multimap/empty.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. +// +//===----------------------------------------------------------------------===// + +// + +// class unordered_multimap + +// bool empty() const 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 + +#include "test_macros.h" + +int main () +{ + std::unordered_multimap c; + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/containers/unord/unord.multiset/empty.fail.cpp b/test/std/containers/unord/unord.multiset/empty.fail.cpp new file mode 100644 index 000000000..8e068a4e1 --- /dev/null +++ b/test/std/containers/unord/unord.multiset/empty.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. +// +//===----------------------------------------------------------------------===// + +// + +// class unordered_multiset + +// bool empty() const 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 + +#include "test_macros.h" + +int main () +{ + std::unordered_multiset c; + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +} diff --git a/test/std/containers/unord/unord.set/empty.fail.cpp b/test/std/containers/unord/unord.set/empty.fail.cpp new file mode 100644 index 000000000..23603c261 --- /dev/null +++ b/test/std/containers/unord/unord.set/empty.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. +// +//===----------------------------------------------------------------------===// + +// + +// class unordered_set + +// bool empty() const 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 + +#include "test_macros.h" + +int main () +{ + std::unordered_set c; + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} +}