]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Initialize member in std::match_results [PR103549]
authorJonathan Wakely <jwakely@redhat.com>
Sat, 4 Dec 2021 11:38:25 +0000 (11:38 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Sat, 4 Dec 2021 15:55:01 +0000 (15:55 +0000)
This fixes a -Wuninitialized warning for std::cmatch m1, m2; m1=m2;

Also name the template parameters in the forward declaration, to get rid
of the <template-parameter-1-1> noise in diagnostics.

libstdc++-v3/ChangeLog:

PR libstdc++/103549
* include/bits/regex.h (match_results): Give names to template
parameters in first declaration.
(match_results::_M_begin): Add default member-initializer.

libstdc++-v3/include/bits/regex.h

index 785edc7180090f8ef3eb28aac603459d26e5641b..52dcd7f86ae3f8dc07605c14217e90944498a0a5 100644 (file)
@@ -35,7 +35,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
   template<typename, typename>
     class basic_regex;
 
-  template<typename, typename>
+  template<typename _Bi_iter, typename _Alloc>
     class match_results;
 
 _GLIBCXX_END_NAMESPACE_CXX11
@@ -2109,7 +2109,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       _M_suffix()
       { return _Unchecked::operator[](_Unchecked::size() - 1); }
 
-      _Bi_iter _M_begin;
+      _Bi_iter _M_begin {};
       /// @endcond
     };