https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121173

            Bug ID: 121173
           Summary: false-positive Wmaybe-uninitialized in
                    std::optional::reset()
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: manx-bugzilla at problemloesungsmaschine dot de
  Target Milestone: ---

The warning is a false-positive to the best of my knowledge. I currently do not
have the time to narrow this test case down further.

GCC 14.2.0 MinGW-w64 amd64 (win32 threading model) on Debian 13.
I have not been able to reproduce for other targets.

manx@vmdebian13:~/tmp$ git clone --quiet https://github.com/OpenMPT/openmpt.git
openmpt.git
manx@vmdebian13:~/tmp$ cd openmpt.git/
manx@vmdebian13:~/tmp/openmpt.git$ git checkout --quiet
41adf7f9af91d69253439dec6c4a51b1ead435b5
manx@vmdebian13:~/tmp/openmpt.git$ x86_64-w64-mingw32-g++ -std=c++23
-fexceptions -frtti -municode -mthreads -fvisibility=hidden -O3
-ffunction-sections -fdata-sections -fno-ipa-ra -Wall -Wextra -Wpedantic
-Wcast-align -Wcast-qual -Wdouble-promotion -Wfloat-conversion
-Wframe-larger-than=16000 -Winit-self -Wlogical-op -Wmissing-declarations
-Wpointer-arith -Wstrict-aliasing                     -Wsuggest-override
-Wundef -Wno-psabi -DNOMINMAX -D_UNICODE -DNTDDI_VERSION=0x0A000000
-D_WIN32_WINNT=0x0A00 -Isrc -Icommon -I.      -D
MPT_SVNURL=\"https://source.openmpt.org/svn/openmpt/trunk/OpenMPT\"; -D
MPT_SVNVERSION=\"23772\" -D MPT_SVNDATE=\"2025-07-16T14:55:10.874787Z\"
-DLIBOPENMPT_BUILD -DMPT_WITH_MINIZ -DMINIZ_NO_STDIO -Iinclude
-DMPT_WITH_MINIMP3 -Iinclude -DMPT_WITH_STBVORBIS -DSTB_VORBIS_NO_PULLDATA_API
-DSTB_VORBIS_NO_STDIO -Iinclude  -c        -o openmpt123/openmpt123.o
openmpt123/openmpt123.cpp
In file included from
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/bits/ranges_algo.h:36,
                 from
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/algorithm:63,
                 from src/mpt/base/saturate_cast.hpp:11,
                 from src/mpt/base/algorithm.hpp:11,
                 from openmpt123/openmpt123.cpp:67:
In member function ‘constexpr void std::_Optional_payload_base<_Tp>::_M_reset()
[with _Tp =
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’,
    inlined from ‘constexpr void std::_Optional_base_impl<_Tp, _Dp>::_M_reset()
[with _Tp =
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>;
_Dp =
std::_Optional_base<mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
false, false>]’ at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:466:53,
    inlined from ‘constexpr void std::optional<_Tp>::reset() [with _Tp =
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:1180:66,
    inlined from
‘mpt::mpt_openmpt123::filemode::iostream_guard<which>::~iostream_guard() [with
mpt::mpt_openmpt123::filemode::stdio which =
mpt::mpt_openmpt123::filemode::stdio::input]’ at
src/mpt/filemode/iostream.hpp:76:14,
    inlined from ‘constexpr void std::destroy_at(_Tp*) [with _Tp =
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’
at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/bits/stl_construct.h:88:18,
    inlined from ‘constexpr void std::_Destroy(_Tp*) [with _Tp =
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’
at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/bits/stl_construct.h:149:22,
    inlined from ‘std::__detail::__variant::_Variant_storage<false,
std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_reset()::<lambda(auto:9&&)> mutable [with auto:9 =
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>&]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:498:19,
    inlined from ‘constexpr _Res std::__invoke_impl(__invoke_other, _Fn&&,
_Args&& ...) [with _Res = void; _Fn =
__detail::__variant::_Variant_storage<false, monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_reset()::<lambda(auto:9&&)>; _Args =
{mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>&}]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/bits/invoke.h:61:36,
    inlined from ‘constexpr std::enable_if_t<((bool)is_invocable_r_v<_Res,
_Callable, _Args ...>), _Res> std::__invoke_r(_Callable&&, _Args&& ...) [with
_Res = void; _Callable = __detail::__variant::_Variant_storage<false,
monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_reset()::<lambda(auto:9&&)>; _Args =
{mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>&}]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/bits/invoke.h:111:28,
    inlined from ‘static constexpr decltype(auto)
std::__detail::__variant::__gen_vtable_impl<std::__detail::__variant::_Multi_array<_Result_type
(*)(_Visitor, _Variants ...)>, std::integer_sequence<long long unsigned int,
__indices ...> >::__visit_invoke(_Visitor&&, _Variants ...) [with _Result_type
= void; _Visitor = std::__detail::__variant::_Variant_storage<false,
std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_reset()::<lambda(auto:9&&)>&&; _Variants = {std::variant<std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>&}; long long unsigned int ...__indices = {1}]’ at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:1064:40,
    inlined from ‘constexpr decltype(auto) std::__do_visit(_Visitor&&,
_Variants&& ...) [with _Result_type = void; _Visitor =
__detail::__variant::_Variant_storage<false, monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_reset()::<lambda(auto:9&&)>; _Variants = {variant<monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>&}]’ at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:1820:5,
    inlined from ‘constexpr void
std::__detail::__variant::_Variant_storage<false, _Types ...>::_M_reset() [with
_Types = {std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>}]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:496:23,
    inlined from ‘constexpr void
std::__detail::__variant::__emplace(_Variant_storage<_Triv, _Types ...>&,
_Args&& ...) [with long long unsigned int _Np = 1; bool _Triv = false; _Types =
{std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>};
_Args = {mpt::mpt_openmpt123::filemode::mode&}]’ at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:565:19,
    inlined from ‘constexpr
std::enable_if_t<((bool)is_constructible_v<std::variant<_Types>::__to_type<_Np,
typename std::enable_if<(_Np < sizeof... (_Types)), void>::type>, _Args ...>),
std::variant<_Types>::__to_type<_Np>&> std::variant<_Types>::emplace(_Args&&
...) [with long long unsigned int _Np = 1; _Args =
{mpt::mpt_openmpt123::filemode::mode&}; _Types = {std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>}]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:1574:33,
    inlined from ‘constexpr std::enable_if_t<((bool)(is_constructible_v<_Tp,
_Args ...> && __exactly_once<_Tp>)), _Tp&>
std::variant<_Types>::emplace(_Args&& ...) [with _Tp =
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>;
_Args = {mpt::mpt_openmpt123::filemode::mode&}; _Types = {std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>}]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:1526:33,
    inlined from
‘mpt::mpt_openmpt123::filemode::stdio_guard<which>::stdio_guard(mpt::mpt_openmpt123::filemode::api,
mpt::mpt_openmpt123::filemode::mode) [with mpt::mpt_openmpt123::filemode::stdio
which = mpt::mpt_openmpt123::filemode::stdio::input]’ at
src/mpt/filemode/stdio.hpp:43:65,
    inlined from ‘constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp =
mpt::mpt_openmpt123::filemode::stdio_guard<mpt::mpt_openmpt123::filemode::stdio::input>;
_Args = {mpt::mpt_openmpt123::filemode::api,
mpt::mpt_openmpt123::filemode::mode}]’ at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/bits/stl_construct.h:119:7,
    inlined from ‘constexpr void
std::_Optional_payload_base<_Tp>::_M_construct(_Args&& ...) [with _Args =
{mpt::mpt_openmpt123::filemode::api, mpt::mpt_openmpt123::filemode::mode}; _Tp
=
mpt::mpt_openmpt123::filemode::stdio_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:274:19,
    inlined from ‘constexpr void std::_Optional_base_impl<_Tp,
_Dp>::_M_construct(_Args&& ...) [with _Args =
{mpt::mpt_openmpt123::filemode::api, mpt::mpt_openmpt123::filemode::mode}; _Tp
=
mpt::mpt_openmpt123::filemode::stdio_guard<mpt::mpt_openmpt123::filemode::stdio::input>;
_Dp =
std::_Optional_base<mpt::mpt_openmpt123::filemode::stdio_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
false, false>]’ at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:455:52,
    inlined from ‘constexpr std::enable_if_t<((bool)is_constructible_v<_Tp,
_Args ...>), _Tp&> std::optional<_Tp>::emplace(_Args&& ...) [with _Args =
{mpt::mpt_openmpt123::filemode::api, mpt::mpt_openmpt123::filemode::mode}; _Tp
=
mpt::mpt_openmpt123::filemode::stdio_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:916:22:
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:313:19: warning:
‘*(std::_Optional_payload_base<mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>*)this.std::_Optional_payload_base<mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_engaged’ may be used uninitialized [-Wmaybe-uninitialized]
  313 |         if (this->_M_engaged)
      |             ~~~~~~^~~~~~~~~~
In member function ‘constexpr void std::_Optional_payload_base<_Tp>::_M_reset()
[with _Tp =
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’,
    inlined from ‘constexpr void std::_Optional_base_impl<_Tp, _Dp>::_M_reset()
[with _Tp =
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>;
_Dp =
std::_Optional_base<mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
false, false>]’ at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:466:53,
    inlined from ‘constexpr void std::optional<_Tp>::reset() [with _Tp =
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:1180:66,
    inlined from
‘mpt::mpt_openmpt123::filemode::iostream_guard<which>::~iostream_guard() [with
mpt::mpt_openmpt123::filemode::stdio which =
mpt::mpt_openmpt123::filemode::stdio::input]’ at
src/mpt/filemode/iostream.hpp:76:14,
    inlined from ‘constexpr void std::destroy_at(_Tp*) [with _Tp =
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’
at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/bits/stl_construct.h:88:18,
    inlined from ‘constexpr void std::_Destroy(_Tp*) [with _Tp =
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’
at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/bits/stl_construct.h:149:22,
    inlined from ‘std::__detail::__variant::_Variant_storage<false,
std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_reset()::<lambda(auto:9&&)> mutable [with auto:9 =
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>&]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:498:19,
    inlined from ‘constexpr _Res std::__invoke_impl(__invoke_other, _Fn&&,
_Args&& ...) [with _Res = void; _Fn =
__detail::__variant::_Variant_storage<false, monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_reset()::<lambda(auto:9&&)>; _Args =
{mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>&}]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/bits/invoke.h:61:36,
    inlined from ‘constexpr std::enable_if_t<((bool)is_invocable_r_v<_Res,
_Callable, _Args ...>), _Res> std::__invoke_r(_Callable&&, _Args&& ...) [with
_Res = void; _Callable = __detail::__variant::_Variant_storage<false,
monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_reset()::<lambda(auto:9&&)>; _Args =
{mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>&}]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/bits/invoke.h:111:28,
    inlined from ‘static constexpr decltype(auto)
std::__detail::__variant::__gen_vtable_impl<std::__detail::__variant::_Multi_array<_Result_type
(*)(_Visitor, _Variants ...)>, std::integer_sequence<long long unsigned int,
__indices ...> >::__visit_invoke(_Visitor&&, _Variants ...) [with _Result_type
= void; _Visitor = std::__detail::__variant::_Variant_storage<false,
std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_reset()::<lambda(auto:9&&)>&&; _Variants = {std::variant<std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>&}; long long unsigned int ...__indices = {1}]’ at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:1064:40,
    inlined from ‘constexpr decltype(auto) std::__do_visit(_Visitor&&,
_Variants&& ...) [with _Result_type = void; _Visitor =
__detail::__variant::_Variant_storage<false, monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_reset()::<lambda(auto:9&&)>; _Variants = {variant<monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>&}]’ at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:1820:5,
    inlined from ‘constexpr void
std::__detail::__variant::_Variant_storage<false, _Types ...>::_M_reset() [with
_Types = {std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>}]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:496:23,
    inlined from ‘constexpr void
std::__detail::__variant::__emplace(_Variant_storage<_Triv, _Types ...>&,
_Args&& ...) [with long long unsigned int _Np = 2; bool _Triv = false; _Types =
{std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>};
_Args = {mpt::mpt_openmpt123::filemode::mode&}]’ at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:565:19,
    inlined from ‘constexpr
std::enable_if_t<((bool)is_constructible_v<std::variant<_Types>::__to_type<_Np,
typename std::enable_if<(_Np < sizeof... (_Types)), void>::type>, _Args ...>),
std::variant<_Types>::__to_type<_Np>&> std::variant<_Types>::emplace(_Args&&
...) [with long long unsigned int _Np = 2; _Args =
{mpt::mpt_openmpt123::filemode::mode&}; _Types = {std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>}]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:1574:33,
    inlined from ‘constexpr std::enable_if_t<((bool)(is_constructible_v<_Tp,
_Args ...> && __exactly_once<_Tp>)), _Tp&>
std::variant<_Types>::emplace(_Args&& ...) [with _Tp =
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>;
_Args = {mpt::mpt_openmpt123::filemode::mode&}; _Types = {std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>}]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:1526:33,
    inlined from
‘mpt::mpt_openmpt123::filemode::stdio_guard<which>::stdio_guard(mpt::mpt_openmpt123::filemode::api,
mpt::mpt_openmpt123::filemode::mode) [with mpt::mpt_openmpt123::filemode::stdio
which = mpt::mpt_openmpt123::filemode::stdio::input]’ at
src/mpt/filemode/stdio.hpp:46:61,
    inlined from ‘constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp =
mpt::mpt_openmpt123::filemode::stdio_guard<mpt::mpt_openmpt123::filemode::stdio::input>;
_Args = {mpt::mpt_openmpt123::filemode::api,
mpt::mpt_openmpt123::filemode::mode}]’ at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/bits/stl_construct.h:119:7,
    inlined from ‘constexpr void
std::_Optional_payload_base<_Tp>::_M_construct(_Args&& ...) [with _Args =
{mpt::mpt_openmpt123::filemode::api, mpt::mpt_openmpt123::filemode::mode}; _Tp
=
mpt::mpt_openmpt123::filemode::stdio_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:274:19,
    inlined from ‘constexpr void std::_Optional_base_impl<_Tp,
_Dp>::_M_construct(_Args&& ...) [with _Args =
{mpt::mpt_openmpt123::filemode::api, mpt::mpt_openmpt123::filemode::mode}; _Tp
=
mpt::mpt_openmpt123::filemode::stdio_guard<mpt::mpt_openmpt123::filemode::stdio::input>;
_Dp =
std::_Optional_base<mpt::mpt_openmpt123::filemode::stdio_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
false, false>]’ at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:455:52,
    inlined from ‘constexpr std::enable_if_t<((bool)is_constructible_v<_Tp,
_Args ...>), _Tp&> std::optional<_Tp>::emplace(_Args&& ...) [with _Args =
{mpt::mpt_openmpt123::filemode::api, mpt::mpt_openmpt123::filemode::mode}; _Tp
=
mpt::mpt_openmpt123::filemode::stdio_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:916:22:
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:313:19: warning:
‘*(std::_Optional_payload_base<mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>*)this.std::_Optional_payload_base<mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_engaged’ may be used uninitialized [-Wmaybe-uninitialized]
  313 |         if (this->_M_engaged)
      |             ~~~~~~^~~~~~~~~~
In member function ‘constexpr void std::_Optional_payload_base<_Tp>::_M_reset()
[with _Tp =
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’,
    inlined from ‘constexpr void std::_Optional_base_impl<_Tp, _Dp>::_M_reset()
[with _Tp =
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>;
_Dp =
std::_Optional_base<mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
false, false>]’ at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:466:53,
    inlined from ‘constexpr void std::optional<_Tp>::reset() [with _Tp =
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:1180:66,
    inlined from
‘mpt::mpt_openmpt123::filemode::iostream_guard<which>::~iostream_guard() [with
mpt::mpt_openmpt123::filemode::stdio which =
mpt::mpt_openmpt123::filemode::stdio::input]’ at
src/mpt/filemode/iostream.hpp:76:14,
    inlined from ‘constexpr void std::destroy_at(_Tp*) [with _Tp =
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’
at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/bits/stl_construct.h:88:18,
    inlined from ‘constexpr void std::_Destroy(_Tp*) [with _Tp =
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’
at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/bits/stl_construct.h:149:22,
    inlined from ‘std::__detail::__variant::_Variant_storage<false,
std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_reset()::<lambda(auto:9&&)> mutable [with auto:9 =
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>&]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:498:19,
    inlined from ‘constexpr _Res std::__invoke_impl(__invoke_other, _Fn&&,
_Args&& ...) [with _Res = void; _Fn =
__detail::__variant::_Variant_storage<false, monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_reset()::<lambda(auto:9&&)>; _Args =
{mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>&}]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/bits/invoke.h:61:36,
    inlined from ‘constexpr std::enable_if_t<((bool)is_invocable_r_v<_Res,
_Callable, _Args ...>), _Res> std::__invoke_r(_Callable&&, _Args&& ...) [with
_Res = void; _Callable = __detail::__variant::_Variant_storage<false,
monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_reset()::<lambda(auto:9&&)>; _Args =
{mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>&}]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/bits/invoke.h:111:28,
    inlined from ‘static constexpr decltype(auto)
std::__detail::__variant::__gen_vtable_impl<std::__detail::__variant::_Multi_array<_Result_type
(*)(_Visitor, _Variants ...)>, std::integer_sequence<long long unsigned int,
__indices ...> >::__visit_invoke(_Visitor&&, _Variants ...) [with _Result_type
= void; _Visitor = std::__detail::__variant::_Variant_storage<false,
std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_reset()::<lambda(auto:9&&)>&&; _Variants = {std::variant<std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>&}; long long unsigned int ...__indices = {1}]’ at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:1064:40,
    inlined from ‘constexpr decltype(auto) std::__do_visit(_Visitor&&,
_Variants&& ...) [with _Result_type = void; _Visitor =
__detail::__variant::_Variant_storage<false, monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_reset()::<lambda(auto:9&&)>; _Variants = {variant<monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>&}]’ at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:1820:5,
    inlined from ‘constexpr void
std::__detail::__variant::_Variant_storage<false, _Types ...>::_M_reset() [with
_Types = {std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>}]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:496:23,
    inlined from ‘constexpr void
std::__detail::__variant::__emplace(_Variant_storage<_Triv, _Types ...>&,
_Args&& ...) [with long long unsigned int _Np = 3; bool _Triv = false; _Types =
{std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>};
_Args = {mpt::mpt_openmpt123::filemode::mode&}]’ at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:565:19,
    inlined from ‘constexpr
std::enable_if_t<((bool)is_constructible_v<std::variant<_Types>::__to_type<_Np,
typename std::enable_if<(_Np < sizeof... (_Types)), void>::type>, _Args ...>),
std::variant<_Types>::__to_type<_Np>&> std::variant<_Types>::emplace(_Args&&
...) [with long long unsigned int _Np = 3; _Args =
{mpt::mpt_openmpt123::filemode::mode&}; _Types = {std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>}]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:1574:33,
    inlined from ‘constexpr std::enable_if_t<((bool)(is_constructible_v<_Tp,
_Args ...> && __exactly_once<_Tp>)), _Tp&>
std::variant<_Types>::emplace(_Args&& ...) [with _Tp =
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>;
_Args = {mpt::mpt_openmpt123::filemode::mode&}; _Types = {std::monostate,
mpt::mpt_openmpt123::filemode::iostream_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
mpt::mpt_openmpt123::filemode::fd_guard<mpt::mpt_openmpt123::filemode::stdio::input>}]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/variant:1526:33,
    inlined from
‘mpt::mpt_openmpt123::filemode::stdio_guard<which>::stdio_guard(mpt::mpt_openmpt123::filemode::api,
mpt::mpt_openmpt123::filemode::mode) [with mpt::mpt_openmpt123::filemode::stdio
which = mpt::mpt_openmpt123::filemode::stdio::input]’ at
src/mpt/filemode/stdio.hpp:49:59,
    inlined from ‘constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp =
mpt::mpt_openmpt123::filemode::stdio_guard<mpt::mpt_openmpt123::filemode::stdio::input>;
_Args = {mpt::mpt_openmpt123::filemode::api,
mpt::mpt_openmpt123::filemode::mode}]’ at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/bits/stl_construct.h:119:7,
    inlined from ‘constexpr void
std::_Optional_payload_base<_Tp>::_M_construct(_Args&& ...) [with _Args =
{mpt::mpt_openmpt123::filemode::api, mpt::mpt_openmpt123::filemode::mode}; _Tp
=
mpt::mpt_openmpt123::filemode::stdio_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:274:19,
    inlined from ‘constexpr void std::_Optional_base_impl<_Tp,
_Dp>::_M_construct(_Args&& ...) [with _Args =
{mpt::mpt_openmpt123::filemode::api, mpt::mpt_openmpt123::filemode::mode}; _Tp
=
mpt::mpt_openmpt123::filemode::stdio_guard<mpt::mpt_openmpt123::filemode::stdio::input>;
_Dp =
std::_Optional_base<mpt::mpt_openmpt123::filemode::stdio_guard<mpt::mpt_openmpt123::filemode::stdio::input>,
false, false>]’ at
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:455:52,
    inlined from ‘constexpr std::enable_if_t<((bool)is_constructible_v<_Tp,
_Args ...>), _Tp&> std::optional<_Tp>::emplace(_Args&& ...) [with _Args =
{mpt::mpt_openmpt123::filemode::api, mpt::mpt_openmpt123::filemode::mode}; _Tp
=
mpt::mpt_openmpt123::filemode::stdio_guard<mpt::mpt_openmpt123::filemode::stdio::input>]’
at /usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:916:22:
/usr/lib/gcc/x86_64-w64-mingw32/14-win32/include/c++/optional:313:19: warning:
‘*(std::_Optional_payload_base<mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>*)this.std::_Optional_payload_base<mpt::mpt_openmpt123::filemode::FILE_guard<mpt::mpt_openmpt123::filemode::stdio::input>
>::_M_engaged’ may be used uninitialized [-Wmaybe-uninitialized]
  313 |         if (this->_M_engaged)
      |             ~~~~~~^~~~~~~~~~
manx@vmdebian13:~/tmp/openmpt.git$ x86_64-w64-mingw32-g++ --version
x86_64-w64-mingw32-g++ (GCC) 14-win32
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

manx@vmdebian13:~/tmp/openmpt.git$
  • [Bug tree-opt... manx-bugzilla at problemloesungsmaschine dot de via Gcc-bugs

Reply via email to