<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/65132>65132</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [libc++] Benchmarks fail to compile with GCC 12
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          var-const
      </td>
    </tr>
</table>

<pre>
    The error:
```
FAILED: src/CMakeFiles/benchmark.dir/benchmark_register.cc.o
/usr/bin/g++-12 -DHAVE_POSIX_REGEX -DHAVE_STD_REGEX -DHAVE_STEADY_CLOCK -I/llvm/third-party/benchmark/include -I/llvm/third-party/benchmark/src -Wno-unused-command-line-argument -nostdinc++ -isystem /llvm
/build/include/c++/v1 -L/llvm/build/lib -Wl,-rpath,/llvm/build/lib -std=c++11  -Wall  -Wextra  -Wshadow  -Wsuggest-override  -pedantic -pedantic-errors  -fstrict-aliasing -Wno-deprecated-declarations
-Wstrict-aliasing  -nostdinc++ -O3 -DNDEBUG -Werror  -Wno-deprecated -MD -MT src/CMakeFiles/benchmark.dir/benchmark_register.cc.o -MF src/CMakeFiles/benchmark.dir/benchmark_register.cc.o.d -o src/CMakeFi
les/benchmark.dir/benchmark_register.cc.o -c /llvm/third-party/benchmark/src/benchmark_register.cc
In file included from /llvm/third-party/benchmark/src/re.h:42,
                 from /llvm/third-party/benchmark/src/benchmark_register.cc:47:
In constructor 'std::__1::__state<char>::__state(std::__1::__state<char>&&)',
    inlined from 'void std::__1::allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::__1::__state<char>; _Args = {std::__1::__state<char>}; _Tp = std::__1::__state<char>]' at /llvm/build/include
/c++/v1/__memory/allocator.h:167:9,
    inlined from 'static void std::__1::allocator_traits<_Alloc>::construct(allocator_type&, _Tp*, _Args&& ...) [with _Tp = std::__1::__state<char>; _Args = {std::__1::__state<char>}; <template-parameter-
2-3> = void; _Alloc = std::__1::allocator<std::__1::__state<char> >]' at /llvm/build/include/c++/v1/__memory/allocator_traits.h:296:22,
    inlined from 'void std::__1::vector<_Tp, _Alloc>::__push_back_slow_path(_Up&&) [with _Up = std::__1::__state<char>; _Tp = std::__1::__state<char>; _Allocator = std::__1::allocator<std::__1::__state<ch
ar> >]' at /llvm/build/include/c++/v1/vector:1646:30,
    inlined from 'void std::__1::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::__1::__state<char>; _Allocator = std::__1::allocator<std::__1::__state<char> >]' at /llvm/build/include/c++/v
1/vector:1676:30,
    inlined from 'bool std::__1::basic_regex<_CharT, _Traits>::__match_at_start_ecma(const _CharT*, const _CharT*, std::__1::match_results<const _CharT*, _Allocator>&, std::__1::regex_constants::match_fla
g_type, bool) const [with _Allocator = std::__1::allocator<std::__1::sub_match<const char*> >; _CharT = char; _Traits = std::__1::regex_traits<char>]' at /llvm/build/include/c++/v1/regex:5857:27:
/llvm/build/include/c++/v1/regex:1429:8: error: '<unnamed>.std::__1::__state<char>::__at_first_' may be used uninitialized [-Werror=maybe-uninitialized]
 1429 | struct __state
 |        ^~~~~~~
/llvm/build/include/c++/v1/regex: In member function 'bool std::__1::basic_regex<_CharT, _Traits>::__match_at_start_ecma(const _CharT*, const _CharT*, std::__1::match_results<const _CharT*, _Allocator>&,
std::__1::regex_constants::match_flag_type, bool) const [with _Allocator = std::__1::allocator<std::__1::sub_match<const char*> >; _CharT = char; _Traits = std::__1::regex_traits<char>]':
/llvm/build/include/c++/v1/regex:5857:28: note: '<anonymous>' declared here
 5857 | __states.push_back(__state());
      | ^~~~~~~~~
In constructor 'std::__1::__state<char>::__state(std::__1::__state<char>&&)',
    inlined from 'void std::__1::allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::__1::__state<char>; _Args = {std::__1::__state<char>}; _Tp = std::__1::__state<char>]' at /llvm/build/include
/c++/v1/__memory/allocator.h:167:9,
    inlined from 'static void std::__1::allocator_traits<_Alloc>::construct(allocator_type&, _Tp*, _Args&& ...) [with _Tp = std::__1::__state<char>; _Args = {std::__1::__state<char>}; <template-parameter-
2-3> = void; _Alloc = std::__1::allocator<std::__1::__state<char> >]' at /llvm/build/include/c++/v1/__memory/allocator_traits.h:296:22,
    inlined from 'void std::__1::deque<_Tp, _Allocator>::push_back(value_type&&) [with _Tp = std::__1::__state<char>; _Allocator = std::__1::allocator<std::__1::__state<char> >]' at /llvm/build/include/c+
+/v1/deque:1483:30,
    inlined from 'bool std::__1::basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(const _CharT*, const _CharT*, std::__1::match_results<const _CharT*, _Allocator>&, std::__1::regex_constants::m
atch_flag_type, bool) const [with _Allocator = std::__1::allocator<std::__1::sub_match<const char*> >; _CharT = char; _Traits = std::__1::regex_traits<char>]' at /llvm/build/include/c++/v1/regex:5938:27:
/llvm/build/include/c++/v1/regex:1429:8: error: '<unnamed>.std::__1::__state<char>::__at_first_' may be used uninitialized [-Werror=maybe-uninitialized]
 1429 | struct __state
 |        ^~~~~~~
/llvm/build/include/c++/v1/regex: In member function 'bool std::__1::basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(const _CharT*, const _CharT*, std::__1::match_results<const _CharT*, _Alloc
ator>&, std::__1::regex_constants::match_flag_type, bool) const [with _Allocator = std::__1::allocator<std::__1::sub_match<const char*> >; _CharT = char; _Traits = std::__1::regex_traits<char>]':
/llvm/build/include/c++/v1/regex:5938:28: note: '<anonymous>' declared here
 5938 | __states.push_back(__state());
      | ^~~~~~~~~
In constructor 'std::__1::__state<char>::__state(std::__1::__state<char>&&)',
    inlined from 'void std::__1::allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::__1::__state<char>; _Args = {std::__1::__state<char>}; _Tp = std::__1::__state<char>]' at /llvm/build/include
/c++/v1/__memory/allocator.h:167:9,
    inlined from 'static void std::__1::allocator_traits<_Alloc>::construct(allocator_type&, _Tp*, _Args&& ...) [with _Tp = std::__1::__state<char>; _Args = {std::__1::__state<char>}; <template-parameter-
2-3> = void; _Alloc = std::__1::allocator<std::__1::__state<char> >]' at /llvm/build/include/c++/v1/__memory/allocator_traits.h:296:22,
    inlined from 'void std::__1::vector<_Tp, _Alloc>::__push_back_slow_path(_Up&&) [with _Up = std::__1::__state<char>; _Tp = std::__1::__state<char>; _Allocator = std::__1::allocator<std::__1::__state<ch
ar> >]' at /llvm/build/include/c++/v1/vector:1646:30,
    inlined from 'void std::__1::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::__1::__state<char>; _Allocator = std::__1::allocator<std::__1::__state<char> >]' at /llvm/build/include/c++/v
1/vector:1676:30,
    inlined from 'bool std::__1::basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(const _CharT*, const _CharT*, std::__1::match_results<const _CharT*, _Allocator>&, std::__1::regex_constants::mat
ch_flag_type, bool) const [with _Allocator = std::__1::allocator<std::__1::sub_match<const char*> >; _CharT = char; _Traits = std::__1::regex_traits<char>]' at /llvm/build/include/c++/v1/regex:6038:27:
/llvm/build/include/c++/v1/regex:1429:8: error: '<unnamed>.std::__1::__state<char>::__at_first_' may be used uninitialized [-Werror=maybe-uninitialized]
 1429 | struct __state
 |        ^~~~~~~
/llvm/build/include/c++/v1/regex: In member function 'bool std::__1::basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(const _CharT*, const _CharT*, std::__1::match_results<const _CharT*, _Allocat
or>&, std::__1::regex_constants::match_flag_type, bool) const [with _Allocator = std::__1::allocator<std::__1::sub_match<const char*> >; _CharT = char; _Traits = std::__1::regex_traits<char>]':
/llvm/build/include/c++/v1/regex:6038:28: note: '<anonymous>' declared here
 6038 | __states.push_back(__state());
      | ^~~~~~~~~
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWk9z27oR_zTQBQONCIiSeNCBIsXU07jpNE6dnjggCYloQEIFQCfuoZ-9A5CUZFt-T3_yMomfNBqborCL3d_ub7GrIdWar2vG5sBfAD8e0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