From c41743d0c0d498bd55c91285d5324b02bed7fb54 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 27 Dec 2017 19:43:33 +0000 Subject: [PATCH] PR libstdc++/83538 fix std::match_results::reference (LWG 2306) PR libstdc++/83538 * doc/xml/manual/intro.xml: Document LWG 2306 change. * include/bits/regex.h (match_results::reference): Change to non-const reference. * testsuite/28_regex/match_results/typedefs.cc: Check types are correct. From-SVN: r256012 --- libstdc++-v3/ChangeLog | 9 +++++++++ libstdc++-v3/doc/xml/manual/intro.xml | 6 ++++++ libstdc++-v3/include/bits/regex.h | 2 +- .../testsuite/28_regex/match_results/typedefs.cc | 7 +++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index bc523a0f056..88b6b2bae85 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2017-12-27 Jonathan Wakely + + PR libstdc++/83538 + * doc/xml/manual/intro.xml: Document LWG 2306 change. + * include/bits/regex.h (match_results::reference): Change to + non-const reference. + * testsuite/28_regex/match_results/typedefs.cc: Check types are + correct. + 2017-12-24 Michele Pezzutti PR libstdc++/83237 diff --git a/libstdc++-v3/doc/xml/manual/intro.xml b/libstdc++-v3/doc/xml/manual/intro.xml index 2df9c5fa6a7..03d59f900ae 100644 --- a/libstdc++-v3/doc/xml/manual/intro.xml +++ b/libstdc++-v3/doc/xml/manual/intro.xml @@ -968,6 +968,12 @@ requirements of the license of GCC. constexpr to addressof for C++17 and later. + 2306: + match_results::reference should be value_type&, not const value_type& + + Change typedef. + + 2313: tuple_size should always derive from integral_constant<size_t, N> diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h index 32e7159eec9..74c5100b524 100644 --- a/libstdc++-v3/include/bits/regex.h +++ b/libstdc++-v3/include/bits/regex.h @@ -1541,7 +1541,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 //@{ typedef sub_match<_Bi_iter> value_type; typedef const value_type& const_reference; - typedef const_reference reference; + typedef value_type& reference; typedef typename _Base_type::const_iterator const_iterator; typedef const_iterator iterator; typedef typename __iter_traits::difference_type difference_type; diff --git a/libstdc++-v3/testsuite/28_regex/match_results/typedefs.cc b/libstdc++-v3/testsuite/28_regex/match_results/typedefs.cc index fb39b5be786..62c4cf71690 100644 --- a/libstdc++-v3/testsuite/28_regex/match_results/typedefs.cc +++ b/libstdc++-v3/testsuite/28_regex/match_results/typedefs.cc @@ -39,4 +39,11 @@ test01() typedef mr::allocator_type allocator_type; typedef mr::char_type char_type; typedef mr::string_type string_type; + + static_assert(std::is_same>::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, "DR 2306"); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); } -- 2.30.2