From patchwork Thu Feb 29 12:28:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 208345 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp355988dyb; Thu, 29 Feb 2024 04:29:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWheDpA3XlzEgiXzibYpalZ4ZECfCjcrvCqCHM5nVyzowprgBBVEAJH2cxlsLVdCqI3Pgvjui+DLsngIp4ncYV3H/GBPg== X-Google-Smtp-Source: AGHT+IEvnDwljjNmvBJeH91Cga1v+NfqYm1F95RmjTypk8sx4ytkFl+vQFEhlxkJ90UmfupEJzhm X-Received: by 2002:a81:4c49:0:b0:608:8f22:d6ad with SMTP id z70-20020a814c49000000b006088f22d6admr1785312ywa.47.1709209749004; Thu, 29 Feb 2024 04:29:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709209748; cv=pass; d=google.com; s=arc-20160816; b=RoOkQ8HVg2IwgH5Orkt/umlTzWIvXmrjIRdukmJtEW4fHrsj3KysH0z+xn6NnY1zuX kQFMEs1+e7s+OMGOsJotWl1JSpfbxPrFOJ541J9Qnqh2aE64T6tFxCe+beZfZHkDn0Nb x+JjNOumuQ1W2pnS8N/fZqAQMqEKxh53at6+qhJCSSO6Bis8R6GWyWn06cDZS4ONvTm4 AdkqhKLP1op3MObm6uy9sq5ekDndfD4GXCOvSpmQiOJWOC9OvSrt5vixFFF0arxeCBpY f7012fj30yqWC5cC5bpWzLFT5FS/09PvOhfhZsu+ZrGFphyo7gtxzcPxwJkGoeB65pIX My8A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:to:subject:message-id:date:from :mime-version:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=SUK0rvll0vG8cDnxAEmdcozUtXWanJpd7JFkT5qqDQ4=; fh=kVPhca5kxWwMbs6iEafY4zcSnu60+bCRJs2zNcdYX8s=; b=LMUsPQA0N8MPITScxJVoT3reSU7Pr/gD885e2G+JGpBM6iNsECLF8GnpM0eTVhhnEt 91WY6R32mKU4b0fdEFHJ7MsjGm2t4l3s7bSWjXFnundcpCRQzr1+cIElAT8XX5C2t4cI da/xwDJ3xUwyQ1cTIFjRcP80tdrvjx/YWyCtTuecYD+IP6M5C/xGV2nKQsa2+qgTJsZB 5xgF9rV1JJBDD5DJ4TKciPKKNTfUa6xxALawDUfBbd7Akn9WHg1kkAdaIZ6CUSpHStHX sJYQS5dIoFeCVuNkAOhLn5CbW9zX61dIigVeTRUjAYEVUAeE9x/WIPrDzE8EtIzGG9Xh yLVA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KoTI9lcP; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id e10-20020ac845ca000000b0042eb8ead343si1202833qto.649.2024.02.29.04.29.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 04:29:08 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KoTI9lcP; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8B3113858C31 for ; Thu, 29 Feb 2024 12:29:08 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 24F23385840D for ; Thu, 29 Feb 2024 12:28:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 24F23385840D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 24F23385840D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709209703; cv=none; b=fHnqo7rckcUjiBQj7+nxg2g5iCDi1lnFA2OFuwLqc1460pSgZYjFzV8c9DZ09tWej2ANoPJf1Cz0nhwlhtfaap797Dx1T73ayJy7OASsxGTyvsIi9DAcIjSP0qVXK7h0JWuDowFxTkOLOBgkUCyazuw1/2X7ZLph2MhjiENdOCo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709209703; c=relaxed/simple; bh=SUK0rvll0vG8cDnxAEmdcozUtXWanJpd7JFkT5qqDQ4=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=gOuNRGtieWCmtkhxnPgq+Mx2oIfU8yw6aTnfm5CF/sb+oDhI+v/gaFAXo2IKJFMTNWCg4hDFty/33mmR8vKj3aR3pr0Sqt7HP5b4meCnD7qhT15+NomGVNNu0gcFjAkrI4weoU1ubXp3pRlUlTVT77B1N8P8+ikQ4N6gpTzWttA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709209700; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=SUK0rvll0vG8cDnxAEmdcozUtXWanJpd7JFkT5qqDQ4=; b=KoTI9lcPg2b+xMWxY3zb3w+xaUmxJwChGZ6P0Oh1RPB7Tm03d5g1WDdVNK9FtTVEgOPTPs age1I2JbYvNssKW8lBkFdxy7RBlHUyKKkF2zOu9NnqMVienODxmRz4IIrWs7V8ekNrr8Ie dm3nnvGegW4CvQw4OyFN5Iy9ePiyzW4= Received: from mail-yb1-f200.google.com (mail-yb1-f200.google.com [209.85.219.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-25-OSWwvIs3NTmqY0cOM6AydQ-1; Thu, 29 Feb 2024 07:28:19 -0500 X-MC-Unique: OSWwvIs3NTmqY0cOM6AydQ-1 Received: by mail-yb1-f200.google.com with SMTP id 3f1490d57ef6-d9a541b720aso1568112276.0 for ; Thu, 29 Feb 2024 04:28:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709209699; x=1709814499; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=c91Eu3yBuMX0Z05NkVv8mRaWZ0NzizGgjvi2varQeLk=; b=JwUx5AG9k3gtlCRT6dC9FMoGRK8aQK3aMC0n9UMQO1QYzNzl81FyrmetygcLSmSrXZ J3XPazZwNxpgzXUUmQUDlvbgFVVy+se8xik4Yon0UKkE6fBCc6HNyPPi/IVNDbbxLxdr +ICWI+6zqQ6MAqwXCiwyt+zE0N4Y3sMlmH0P/UgAmfr45WyQBmCj3Ffq3gQfqvyfGwJK 0Hjefs+2IsTOHINb3O++ISuoUuWBu2vfJgN5wwAJRuzjVQX/kloY9vwtpGEhkLeyw6vF TdxGFDqscT4qXAOZy0YtvYgKpCuyLRGIiIOPEGG+vBjXTnfsRftkZsI7PRevE3TZRuGs 5xTQ== X-Forwarded-Encrypted: i=1; AJvYcCVCleRLu3e6E73TMQnHu7zymNmrkotbUzUK2VnLRKBGaz9P3CZk6MeggAK4rE1bsKvzjoF/9yl1JhrPN01FDusk9t2lC5dVgg== X-Gm-Message-State: AOJu0Yykk6/xrnENCK7FuZibrkLBySFV/XgBknrZYGMaiseGC4CHlwnJ Ta4Tw4UDpVCWRRF1HwAGJ4gn26yGln8+AWmkNHENXy82Gt/0VHiAcmIV/MllXaX5wXIs1b4KmmZ h8HFbwgo7+LDIakr4iQwTIbQY5jnM91FcXLv5HRyxYwF6Z8ue+u93NBFQa10Z5kkjbf8pBQFtei PNzpj0jerGO1sHsbDDiCrcuhfICSmTNGGeax70DQ== X-Received: by 2002:a25:dc02:0:b0:dc2:1f53:3a4f with SMTP id y2-20020a25dc02000000b00dc21f533a4fmr1893315ybe.5.1709209698703; Thu, 29 Feb 2024 04:28:18 -0800 (PST) X-Received: by 2002:a25:dc02:0:b0:dc2:1f53:3a4f with SMTP id y2-20020a25dc02000000b00dc21f533a4fmr1893302ybe.5.1709209698304; Thu, 29 Feb 2024 04:28:18 -0800 (PST) MIME-Version: 1.0 From: Jonathan Wakely Date: Thu, 29 Feb 2024 12:28:01 +0000 Message-ID: Subject: [PATCH v2] libstdc++: Add more nodiscard uses in To: "libstdc++" , gcc Patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792236321514631954 X-GMAIL-MSGID: 1792236321514631954 We need to add [[nodiscard]] to the comparison ops in too, which I missed in the v1 patch. Tested aarch64-linux. Pushed to trunk (yesterday). commit 26d6a714b29eeef77591f136f5162622a549d8fd Author: Jonathan Wakely Date: Mon Feb 26 13:09:02 2024 libstdc++: Add more nodiscard uses in Add [[nodiscard]] to vector::at and to comparison operators. libstdc++-v3/ChangeLog: * include/bits/stl_bvector.h (vector::at): Add nodiscard. * include/bits/stl_vector.h (vector::at): Likewise. (operator==, operator<=>, operator<, operator!=, operator>) (operator<=, operator>=): Likewise. * include/debug/vector (operator==, operator<=>, operator<) (operator!=, operator>, operator<=, operator>=): Likewise. * testsuite/23_containers/vector/nodiscard.cc: New test. diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h index aa5644b4a0e..2c8b892b07a 100644 --- a/libstdc++-v3/include/bits/stl_bvector.h +++ b/libstdc++-v3/include/bits/stl_bvector.h @@ -1101,7 +1101,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } public: - _GLIBCXX20_CONSTEXPR + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR reference at(size_type __n) { @@ -1109,7 +1109,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER return (*this)[__n]; } - _GLIBCXX20_CONSTEXPR + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR const_reference at(size_type __n) const { diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index 6a9543eefce..a8d387f40a1 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -1172,7 +1172,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * is first checked that it is in the range of the vector. The * function throws out_of_range if the check fails. */ - _GLIBCXX20_CONSTEXPR + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR reference at(size_type __n) { @@ -1191,7 +1191,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * is first checked that it is in the range of the vector. The * function throws out_of_range if the check fails. */ - _GLIBCXX20_CONSTEXPR + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR const_reference at(size_type __n) const { @@ -2042,7 +2042,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * and if corresponding elements compare equal. */ template - _GLIBCXX20_CONSTEXPR + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR inline bool operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { return (__x.size() == __y.size() @@ -2061,7 +2061,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * `<` and `>=` etc. */ template - _GLIBCXX20_CONSTEXPR + [[nodiscard]] _GLIBCXX20_CONSTEXPR inline __detail::__synth3way_t<_Tp> operator<=>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { @@ -2082,32 +2082,32 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * See std::lexicographical_compare() for how the determination is made. */ template - inline bool + _GLIBCXX_NODISCARD inline bool operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); } /// Based on operator== template - inline bool + _GLIBCXX_NODISCARD inline bool operator!=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { return !(__x == __y); } /// Based on operator< template - inline bool + _GLIBCXX_NODISCARD inline bool operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { return __y < __x; } /// Based on operator< template - inline bool + _GLIBCXX_NODISCARD inline bool operator<=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { return !(__y < __x); } /// Based on operator< template - inline bool + _GLIBCXX_NODISCARD inline bool operator>=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { return !(__x < __y); } #endif // three-way comparison diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector index 5a0fc808651..216822975a2 100644 --- a/libstdc++-v3/include/debug/vector +++ b/libstdc++-v3/include/debug/vector @@ -866,7 +866,7 @@ namespace __debug }; template - _GLIBCXX20_CONSTEXPR + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR inline bool operator==(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) @@ -874,35 +874,41 @@ namespace __debug #if __cpp_lib_three_way_comparison template + [[nodiscard]] constexpr __detail::__synth3way_t<_Tp> operator<=>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { return __x._M_base() <=> __y._M_base(); } #else template + _GLIBCXX_NODISCARD inline bool operator!=(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) { return __lhs._M_base() != __rhs._M_base(); } template + _GLIBCXX_NODISCARD inline bool operator<(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) { return __lhs._M_base() < __rhs._M_base(); } template + _GLIBCXX_NODISCARD inline bool operator<=(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) { return __lhs._M_base() <= __rhs._M_base(); } template + _GLIBCXX_NODISCARD inline bool operator>=(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) { return __lhs._M_base() >= __rhs._M_base(); } template + _GLIBCXX_NODISCARD inline bool operator>(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) diff --git a/libstdc++-v3/testsuite/23_containers/vector/nodiscard.cc b/libstdc++-v3/testsuite/23_containers/vector/nodiscard.cc new file mode 100644 index 00000000000..3b5480d16d4 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/nodiscard.cc @@ -0,0 +1,153 @@ +// { dg-do compile { target c++17 } } + +#include + +void +test_observers(std::vector v) +{ + v.size(); // { dg-warning "ignoring return value" } + v.capacity(); // { dg-warning "ignoring return value" } + v.empty(); // { dg-warning "ignoring return value" } +} + +void +test_element_access(std::vector v) +{ + v.front(); // { dg-warning "ignoring return value" } + v.back(); // { dg-warning "ignoring return value" } + v[1]; // { dg-warning "ignoring return value" } + v.at(1); // { dg-warning "ignoring return value" } + v.data(); // { dg-warning "ignoring return value" } + const auto& cv = v; + cv[1]; // { dg-warning "ignoring return value" } + cv.at(1); // { dg-warning "ignoring return value" } + cv.data(); // { dg-warning "ignoring return value" } +} + +void +test_rel_ops(std::vector v) +{ + v == v; // { dg-warning "ignoring return value" } + v != v; // { dg-warning "ignoring return value" "PR c++/114104" { target c++17_down } } + v < v; // { dg-warning "ignoring return value" } + v > v; // { dg-warning "ignoring return value" } + v <= v; // { dg-warning "ignoring return value" } + v >= v; // { dg-warning "ignoring return value" } +} + +struct S { }; + +void +test_iterators(std::vector v) +{ + v.begin(); // { dg-warning "ignoring return value" } + v.end(); // { dg-warning "ignoring return value" } + v.rbegin(); // { dg-warning "ignoring return value" } + v.rend(); // { dg-warning "ignoring return value" } + const auto& cv = v; + cv.begin(); // { dg-warning "ignoring return value" } + cv.end(); // { dg-warning "ignoring return value" } + cv.rbegin(); // { dg-warning "ignoring return value" } + cv.rend(); // { dg-warning "ignoring return value" } + + v.cbegin(); // { dg-warning "ignoring return value" } + v.cend(); // { dg-warning "ignoring return value" } + v.crbegin(); // { dg-warning "ignoring return value" } + v.crend(); // { dg-warning "ignoring return value" } + + auto i = v.begin(), j = v.end(); + i == j; // { dg-warning "ignoring return value" } + i != j; // { dg-warning "ignoring return value" "PR c++/114104" { target c++17_down } } + i < j; // { dg-warning "ignoring return value" } + i > j; // { dg-warning "ignoring return value" } + i <= j; // { dg-warning "ignoring return value" } + i >= j; // { dg-warning "ignoring return value" } + + auto ci = cv.begin(), cj = cv.end(); + ci == cj; // { dg-warning "ignoring return value" } + ci != cj; // { dg-warning "ignoring return value" "PR c++/114104" { target c++17_down } } + ci < cj; // { dg-warning "ignoring return value" } + ci > cj; // { dg-warning "ignoring return value" } + ci <= cj; // { dg-warning "ignoring return value" } + ci >= cj; // { dg-warning "ignoring return value" } + + ci == j; // { dg-warning "ignoring return value" } + ci != j; // { dg-warning "ignoring return value" "PR c++/114104" { target c++17_down } } + ci < j; // { dg-warning "ignoring return value" } + ci > j; // { dg-warning "ignoring return value" } + ci <= j; // { dg-warning "ignoring return value" } + ci >= j; // { dg-warning "ignoring return value" } +} + +void +test_observers(std::vector v) +{ + v.size(); // { dg-warning "ignoring return value" } + v.capacity(); // { dg-warning "ignoring return value" } + v.empty(); // { dg-warning "ignoring return value" } +} + +void +test_element_access(std::vector v) +{ + v.front(); // { dg-warning "ignoring return value" } + v.back(); // { dg-warning "ignoring return value" } + v[1]; // { dg-warning "ignoring return value" } + v.at(1); // { dg-warning "ignoring return value" } + const auto& cv = v; + cv[1]; // { dg-warning "ignoring return value" } + cv.at(1); // { dg-warning "ignoring return value" } +} + +void +test_rel_ops(std::vector v) +{ + v == v; // { dg-warning "ignoring return value" } + v != v; // { dg-warning "ignoring return value" "PR c++/114104" { target c++17_down } } + v < v; // { dg-warning "ignoring return value" } + v > v; // { dg-warning "ignoring return value" } + v <= v; // { dg-warning "ignoring return value" } + v >= v; // { dg-warning "ignoring return value" } +} + +void +test_iterators(std::vector v) +{ + v.begin(); // { dg-warning "ignoring return value" } + v.end(); // { dg-warning "ignoring return value" } + v.rbegin(); // { dg-warning "ignoring return value" } + v.rend(); // { dg-warning "ignoring return value" } + const auto& cv = v; + cv.begin(); // { dg-warning "ignoring return value" } + cv.end(); // { dg-warning "ignoring return value" } + cv.rbegin(); // { dg-warning "ignoring return value" } + cv.rend(); // { dg-warning "ignoring return value" } + + v.cbegin(); // { dg-warning "ignoring return value" } + v.cend(); // { dg-warning "ignoring return value" } + v.crbegin(); // { dg-warning "ignoring return value" } + v.crend(); // { dg-warning "ignoring return value" } + + auto i = v.begin(), j = v.end(); + i == j; // { dg-warning "ignoring return value" } + i != j; // { dg-warning "ignoring return value" "PR c++/114104" { target c++17_down } } + i < j; // { dg-warning "ignoring return value" } + i > j; // { dg-warning "ignoring return value" } + i <= j; // { dg-warning "ignoring return value" } + i >= j; // { dg-warning "ignoring return value" } + + auto ci = cv.begin(), cj = cv.end(); + ci == cj; // { dg-warning "ignoring return value" } + ci != cj; // { dg-warning "ignoring return value" "PR c++/114104" { target c++17_down } } + ci < cj; // { dg-warning "ignoring return value" } + ci > cj; // { dg-warning "ignoring return value" } + ci <= cj; // { dg-warning "ignoring return value" } + ci >= cj; // { dg-warning "ignoring return value" } + + ci == j; // { dg-warning "ignoring return value" } + ci != j; // { dg-warning "ignoring return value" "PR c++/114104" { target c++17_down } } + ci < j; // { dg-warning "ignoring return value" } + ci > j; // { dg-warning "ignoring return value" } + ci <= j; // { dg-warning "ignoring return value" } + ci >= j; // { dg-warning "ignoring return value" } +}