aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-04-09 19:50:39 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2019-04-09 19:50:39 +0100
commitbc203bf0dab0cdb39370357bc3244999a2f9e419 (patch)
tree15d5ca0efc4cd2952bb566a9748855f50d48db6c
parent51d63c036b8d9f46dc07ca6a1cda75ba34d74367 (diff)
downloadgcc-bc203bf0dab0cdb39370357bc3244999a2f9e419.zip
gcc-bc203bf0dab0cdb39370357bc3244999a2f9e419.tar.gz
gcc-bc203bf0dab0cdb39370357bc3244999a2f9e419.tar.bz2
PR libstdc++/90008 remove unused capture from variant rel ops
PR libstdc++/90008 * include/std/variant (_VARIANT_RELATION_FUNCTION_TEMPLATE): Remove unused capture. * testsuite/20_util/variant/90008.cc: New test. From-SVN: r270236
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/include/std/variant2
-rw-r--r--libstdc++-v3/testsuite/20_util/variant/90008.cc37
3 files changed, 45 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index eaad7c6..0d30d50 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,10 @@
+2019-04-09 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/90008
+ * include/std/variant (_VARIANT_RELATION_FUNCTION_TEMPLATE): Remove
+ unused capture.
+ * testsuite/20_util/variant/90008.cc: New test.
+
2019-04-09 Thomas Rodgers <trodgers@redhat.com>
* include/pstl/algorithm_impl.h: Add namespace qualification.
diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index 7bab472..603b6be 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -1160,7 +1160,7 @@ namespace __variant
{ \
bool __ret = true; \
__do_visit<__detail::__variant::__visit_with_index>( \
- [&__ret, &__lhs, __rhs] \
+ [&__ret, &__lhs] \
(auto&& __rhs_mem, auto __rhs_index) mutable \
-> __detail::__variant::__variant_idx_cookie \
{ \
diff --git a/libstdc++-v3/testsuite/20_util/variant/90008.cc b/libstdc++-v3/testsuite/20_util/variant/90008.cc
new file mode 100644
index 0000000..53fd35d
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/variant/90008.cc
@@ -0,0 +1,37 @@
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++17 } }
+
+#include <variant>
+
+struct NoCopy
+{
+ NoCopy();
+ NoCopy(const NoCopy&) = delete;
+};
+
+bool operator==(const NoCopy&, const NoCopy&);
+
+using V = std::variant<NoCopy, int>;
+
+bool
+test01(const V& lhs, const V& rhs)
+{
+ return lhs == rhs;
+}