PR libstdc++/83538 fix std::match_results<T>::reference (LWG 2306)
authorJonathan Wakely <jwakely@redhat.com>
Wed, 27 Dec 2017 19:43:33 +0000 (19:43 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 27 Dec 2017 19:43:33 +0000 (19:43 +0000)
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
libstdc++-v3/doc/xml/manual/intro.xml
libstdc++-v3/include/bits/regex.h
libstdc++-v3/testsuite/28_regex/match_results/typedefs.cc

index bc523a0f056944d5cbb5effa2505872b2545b6c9..88b6b2bae85795f2239a007708c9cf064bb13c25 100644 (file)
@@ -1,3 +1,12 @@
+2017-12-27  Jonathan Wakely  <jwakely@redhat.com>
+
+       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 <mpezz@tiscali.it>
 
        PR libstdc++/83237
index 2df9c5fa6a79f1501f95ca744841fa4cfcc6be4a..03d59f900ae67b2ad4ef4363f672236c2d473006 100644 (file)
@@ -968,6 +968,12 @@ requirements of the license of GCC.
     <code>constexpr</code> to <code>addressof</code> for C++17 and later.
     </para></listitem></varlistentry>
 
+    <varlistentry xml:id="manual.bugs.dr2306"><term><link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&DR;#2306">2306</link>:
+       <emphasis><code>match_results::reference</code> should be <code>value_type&amp;</code>, not <code>const value_type&amp;</code></emphasis>
+    </term>
+    <listitem><para>Change typedef.
+    </para></listitem></varlistentry>
+
     <varlistentry xml:id="manual.bugs.dr2313"><term><link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&DR;#2313">2313</link>:
        <emphasis><code>tuple_size</code> should always derive from <code>integral_constant&lt;size_t, N&gt;</code></emphasis>
     </term>
index 32e7159eec916640ae3a4781ad682cfc4f0fdedf..74c5100b52499161026e84062aa599fb4522380c 100644 (file)
@@ -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;
index fb39b5be78627cf044cc8c4015d418b913bde068..62c4cf716902a9a8555f2ac0a1d24cd895f1b626 100644 (file)
@@ -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_type, std::sub_match<char*>>::value, "");
+  static_assert(std::is_same<const_reference, const value_type&>::value, "");
+  static_assert(std::is_same<reference, value_type&>::value, "DR 2306");
+  static_assert(std::is_same<const_iterator, iterator>::value, "");
+  static_assert(std::is_same<char_type, char>::value, "");
+  static_assert(std::is_same<string_type, std::string>::value, "");
 }