https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107138
Bug ID: 107138 Summary: [12 regression] std::variant<std::string, ...> triggers false-positive 'may be used uninitialized' warning Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: carsten.andrich at gmx dot de Target Milestone: --- Created attachment 53660 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53660&action=edit .ii file as per bug writing guidelines Compiling the following code using an std::string inside an std::variant compiles without warnings on g++ 10.4.0 and 11.3.0 as well as clang++ 14.0.6 with -std=c++17 -Wall -Wextra -O2 -fsanitize=undefined: ``` #include <variant> #include <vector> #include <string> class Toml { public: class Array; typedef std::variant<std::string, int, double, bool, Array> value_t; class Array { public: std::vector<value_t> data; Array(const std::vector<double> &data) { this->data.reserve(data.size()); for (const double &elem : data) { this->data.push_back(elem); } } }; }; int main(int argc, char *argv[]) { (void) argc; (void) argv; std::vector<double> a = { 42., 42. }; auto array = Toml::Array(a); return 0; } ``` However on g++ 12.2.0 as well as gcc 13 trunk (https://godbolt.org/z/6MqGWcPhr) it triggers what I believe are several false positive 'may be used uninitialized' warnings. Removing the std::string from the std::variant resolves the issue. ``` Using built-in specs. COLLECT_GCC=g++-12 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/12/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 12.2.0-4' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-12 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-12-zSjAmm/gcc-12-12.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-12-zSjAmm/gcc-12-12.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.2.0 (Debian 12.2.0-4) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++17' '-Wall' '-Wextra' '-O2' '-o' 'gcc_bug' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-linux-gnu/12/cc1plus -E -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE gcc_bug.cpp -mtune=generic -march=x86-64 -std=c++17 -Wall -Wextra -O2 -fpch-preprocess -fasynchronous-unwind-tables -o gcc_bug.ii ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/12" ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/12/include-fixed" ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/include/c++/12 /usr/include/x86_64-linux-gnu/c++/12 /usr/include/c++/12/backward /usr/lib/gcc/x86_64-linux-gnu/12/include /usr/local/include /usr/include/x86_64-linux-gnu /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++17' '-Wall' '-Wextra' '-O2' '-o' 'gcc_bug' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-linux-gnu/12/cc1plus -fpreprocessed gcc_bug.ii -quiet -dumpbase gcc_bug.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -O2 -Wall -Wextra -std=c++17 -version -fasynchronous-unwind-tables -o gcc_bug.s GNU C++17 (Debian 12.2.0-4) version 12.2.0 (x86_64-linux-gnu) compiled by GNU C version 12.2.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.25-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C++17 (Debian 12.2.0-4) version 12.2.0 (x86_64-linux-gnu) compiled by GNU C version 12.2.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.25-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 2f2982b7a0eb82900d513759f8d84f81 In file included from /usr/include/c++/12/string:53, from gcc_bug.cpp:3: In member function ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’, inlined from ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ at /usr/include/c++/12/bits/basic_string.h:676:22, inlined from ‘constexpr std::__detail::__variant::_Uninitialized<_Type, false>::_Uninitialized(std::in_place_index_t<0>, _Args&& ...) [with _Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}; _Type = std::__cxx11::basic_string<char>]’ at /usr/include/c++/12/variant:283:4, inlined from ‘constexpr std::__detail::__variant::_Variadic_union<_First, _Rest ...>::_Variadic_union(std::in_place_index_t<0>, _Args&& ...) [with _Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}; _First = std::__cxx11::basic_string<char>; _Rest = {int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:385:4, inlined from ‘void std::_Construct(_Tp*, _Args&& ...) [with _Tp = __detail::__variant::_Variadic_union<__cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>; _Args = {const in_place_index_t<0>&, __cxx11::basic_string<char, char_traits<char>, allocator<char> >}]’ at /usr/include/c++/12/bits/stl_construct.h:119:7, inlined from ‘std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)> mutable [with auto:4 = std::__cxx11::basic_string<char>; auto:5 = std::integral_constant<long unsigned int, 0>]’ at /usr/include/c++/12/variant:605:23, inlined from ‘constexpr _Res std::__invoke_impl(__invoke_other, _Fn&&, _Args&& ...) [with _Res = void; _Fn = __detail::__variant::_Move_ctor_base<false, __cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Args = {__cxx11::basic_string<char, char_traits<char>, allocator<char> >, integral_constant<long unsigned int, 0>}]’ at /usr/include/c++/12/bits/invoke.h:61:36, inlined from ‘constexpr typename std::__invoke_result<_Functor, _ArgTypes>::type std::__invoke(_Callable&&, _Args&& ...) [with _Callable = __detail::__variant::_Move_ctor_base<false, __cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Args = {__cxx11::basic_string<char, char_traits<char>, allocator<char> >, integral_constant<long unsigned int, 0>}]’ at /usr/include/c++/12/bits/invoke.h:96:40, 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 unsigned int, __indices ...> >::__visit_invoke(_Visitor&&, _Variants ...) [with _Result_type = std::__detail::__variant::__variant_idx_cookie; _Visitor = std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>&&; _Variants = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&}; long unsigned int ...__indices = {0}]’ at /usr/include/c++/12/variant:1020:17, inlined from ‘constexpr decltype(auto) std::__do_visit(_Visitor&&, _Variants&& ...) [with _Result_type = __detail::__variant::__variant_idx_cookie; _Visitor = __detail::__variant::_Move_ctor_base<false, __cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Variants = {variant<__cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>}]’ at /usr/include/c++/12/variant:1783:105, inlined from ‘constexpr void std::__detail::__variant::__raw_idx_visit(_Visitor&&, _Variants&& ...) [with _Visitor = _Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Variants = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>}]’ at /usr/include/c++/12/variant:184:44, inlined from ‘std::__detail::__variant::_Move_ctor_base<<anonymous>, _Types>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<<anonymous>, _Types>&&) [with bool <anonymous> = false; _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:600:28, inlined from ‘std::__detail::__variant::_Copy_assign_base<<anonymous>, _Types>::_Copy_assign_base(std::__detail::__variant::_Copy_assign_base<<anonymous>, _Types>&&) [with bool <anonymous> = false; _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:665:7, inlined from ‘std::__detail::__variant::_Move_assign_base<<anonymous>, _Types>::_Move_assign_base(std::__detail::__variant::_Move_assign_base<<anonymous>, _Types>&&) [with bool <anonymous> = false; _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:719:7, inlined from ‘std::__detail::__variant::_Variant_base<_Types>::_Variant_base(std::__detail::__variant::_Variant_base<_Types>&&) [with _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:750:7, inlined from ‘std::variant<_Types>::variant(std::variant<_Types>&&) [with _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:1404:7, inlined from ‘void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Args = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>}; _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>]’ at /usr/include/c++/12/bits/new_allocator.h:175:4, inlined from ‘static void std::allocator_traits<std::allocator<_Tp1> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Args = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>}; _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>]’ at /usr/include/c++/12/bits/alloc_traits.h:516:17, inlined from ‘std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>}; _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Alloc = std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> >]’ at /usr/include/c++/12/bits/vector.tcc:117:30, inlined from ‘void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Alloc = std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> >]’ at /usr/include/c++/12/bits/stl_vector.h:1294:21, inlined from ‘Toml::Array::Array(const std::vector<double>&)’ at gcc_bug.cpp:19:37: /usr/include/c++/12/bits/basic_string.h:1071:16: warning: ‘*(const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)((char*)&<unnamed> + offsetof(std::value_type, std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Variant_base<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Move_assign_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Copy_assign_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Copy_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Variant_storage<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::_M_u)).std::__cxx11::basic_string<char>::_M_string_length’ may be used uninitialized [-Wmaybe-uninitialized] 1071 | { return _M_string_length; } | ^~~~~~~~~~~~~~~~ gcc_bug.cpp: In constructor ‘Toml::Array::Array(const std::vector<double>&)’: gcc_bug.cpp:19:37: note: ‘<anonymous>’ declared here 19 | this->data.push_back(elem); | ~~~~~~~~~~~~~~~~~~~~^~~~~~ In member function ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’, inlined from ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ at /usr/include/c++/12/bits/basic_string.h:687:11, inlined from ‘constexpr std::__detail::__variant::_Uninitialized<_Type, false>::_Uninitialized(std::in_place_index_t<0>, _Args&& ...) [with _Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}; _Type = std::__cxx11::basic_string<char>]’ at /usr/include/c++/12/variant:283:4, inlined from ‘constexpr std::__detail::__variant::_Variadic_union<_First, _Rest ...>::_Variadic_union(std::in_place_index_t<0>, _Args&& ...) [with _Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}; _First = std::__cxx11::basic_string<char>; _Rest = {int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:385:4, inlined from ‘void std::_Construct(_Tp*, _Args&& ...) [with _Tp = __detail::__variant::_Variadic_union<__cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>; _Args = {const in_place_index_t<0>&, __cxx11::basic_string<char, char_traits<char>, allocator<char> >}]’ at /usr/include/c++/12/bits/stl_construct.h:119:7, inlined from ‘std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)> mutable [with auto:4 = std::__cxx11::basic_string<char>; auto:5 = std::integral_constant<long unsigned int, 0>]’ at /usr/include/c++/12/variant:605:23, inlined from ‘constexpr _Res std::__invoke_impl(__invoke_other, _Fn&&, _Args&& ...) [with _Res = void; _Fn = __detail::__variant::_Move_ctor_base<false, __cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Args = {__cxx11::basic_string<char, char_traits<char>, allocator<char> >, integral_constant<long unsigned int, 0>}]’ at /usr/include/c++/12/bits/invoke.h:61:36, inlined from ‘constexpr typename std::__invoke_result<_Functor, _ArgTypes>::type std::__invoke(_Callable&&, _Args&& ...) [with _Callable = __detail::__variant::_Move_ctor_base<false, __cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Args = {__cxx11::basic_string<char, char_traits<char>, allocator<char> >, integral_constant<long unsigned int, 0>}]’ at /usr/include/c++/12/bits/invoke.h:96:40, 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 unsigned int, __indices ...> >::__visit_invoke(_Visitor&&, _Variants ...) [with _Result_type = std::__detail::__variant::__variant_idx_cookie; _Visitor = std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>&&; _Variants = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&}; long unsigned int ...__indices = {0}]’ at /usr/include/c++/12/variant:1020:17, inlined from ‘constexpr decltype(auto) std::__do_visit(_Visitor&&, _Variants&& ...) [with _Result_type = __detail::__variant::__variant_idx_cookie; _Visitor = __detail::__variant::_Move_ctor_base<false, __cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Variants = {variant<__cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>}]’ at /usr/include/c++/12/variant:1783:105, inlined from ‘constexpr void std::__detail::__variant::__raw_idx_visit(_Visitor&&, _Variants&& ...) [with _Visitor = _Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Variants = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>}]’ at /usr/include/c++/12/variant:184:44, inlined from ‘std::__detail::__variant::_Move_ctor_base<<anonymous>, _Types>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<<anonymous>, _Types>&&) [with bool <anonymous> = false; _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:600:28, inlined from ‘std::__detail::__variant::_Copy_assign_base<<anonymous>, _Types>::_Copy_assign_base(std::__detail::__variant::_Copy_assign_base<<anonymous>, _Types>&&) [with bool <anonymous> = false; _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:665:7, inlined from ‘std::__detail::__variant::_Move_assign_base<<anonymous>, _Types>::_Move_assign_base(std::__detail::__variant::_Move_assign_base<<anonymous>, _Types>&&) [with bool <anonymous> = false; _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:719:7, inlined from ‘std::__detail::__variant::_Variant_base<_Types>::_Variant_base(std::__detail::__variant::_Variant_base<_Types>&&) [with _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:750:7, inlined from ‘std::variant<_Types>::variant(std::variant<_Types>&&) [with _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:1404:7, inlined from ‘void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Args = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>}; _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>]’ at /usr/include/c++/12/bits/new_allocator.h:175:4, inlined from ‘static void std::allocator_traits<std::allocator<_Tp1> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Args = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>}; _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>]’ at /usr/include/c++/12/bits/alloc_traits.h:516:17, inlined from ‘std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>}; _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Alloc = std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> >]’ at /usr/include/c++/12/bits/vector.tcc:117:30, inlined from ‘void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Alloc = std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> >]’ at /usr/include/c++/12/bits/stl_vector.h:1294:21, inlined from ‘Toml::Array::Array(const std::vector<double>&)’ at gcc_bug.cpp:19:37: /usr/include/c++/12/bits/basic_string.h:1071:16: warning: ‘*(const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)((char*)&<unnamed> + offsetof(std::value_type, std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Variant_base<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Move_assign_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Copy_assign_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Copy_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Variant_storage<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::_M_u)).std::__cxx11::basic_string<char>::_M_string_length’ may be used uninitialized [-Wmaybe-uninitialized] 1071 | { return _M_string_length; } | ^~~~~~~~~~~~~~~~ gcc_bug.cpp: In constructor ‘Toml::Array::Array(const std::vector<double>&)’: gcc_bug.cpp:19:37: note: ‘<anonymous>’ declared here 19 | this->data.push_back(elem); | ~~~~~~~~~~~~~~~~~~~~^~~~~~ In file included from /usr/include/c++/12/vector:64, from gcc_bug.cpp:2: In constructor ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl_data::_Vector_impl_data(std::_Vector_base<_Tp, _Alloc>::_Vector_impl_data&&) [with _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Alloc = std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> >]’, inlined from ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl(std::_Vector_base<_Tp, _Alloc>::_Vector_impl&&) [with _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Alloc = std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> >]’ at /usr/include/c++/12/bits/stl_vector.h:152:68, inlined from ‘std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::_Vector_base<_Tp, _Alloc>&&) [with _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Alloc = std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> >]’ at /usr/include/c++/12/bits/stl_vector.h:335:7, inlined from ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Alloc = std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> >]’ at /usr/include/c++/12/bits/stl_vector.h:615:7, inlined from ‘Toml::Array::Array(Toml::Array&&)’ at gcc_bug.cpp:11:11, inlined from ‘constexpr std::__detail::__variant::_Uninitialized<_Type, false>::_Uninitialized(std::in_place_index_t<0>, _Args&& ...) [with _Args = {Toml::Array}; _Type = Toml::Array]’ at /usr/include/c++/12/variant:283:4, inlined from ‘constexpr std::__detail::__variant::_Variadic_union<_First, _Rest ...>::_Variadic_union(std::in_place_index_t<0>, _Args&& ...) [with _Args = {Toml::Array}; _First = Toml::Array; _Rest = {}]’ at /usr/include/c++/12/variant:385:4, inlined from ‘constexpr std::__detail::__variant::_Variadic_union<_First, _Rest ...>::_Variadic_union(std::in_place_index_t<_Np>, _Args&& ...) [with long unsigned int _Np = 1; _Args = {Toml::Array}; _First = bool; _Rest = {Toml::Array}]’ at /usr/include/c++/12/variant:391:4, inlined from ‘constexpr std::__detail::__variant::_Variadic_union<_First, _Rest ...>::_Variadic_union(std::in_place_index_t<_Np>, _Args&& ...) [with long unsigned int _Np = 2; _Args = {Toml::Array}; _First = double; _Rest = {bool, Toml::Array}]’ at /usr/include/c++/12/variant:391:4, inlined from ‘constexpr std::__detail::__variant::_Variadic_union<_First, _Rest ...>::_Variadic_union(std::in_place_index_t<_Np>, _Args&& ...) [with long unsigned int _Np = 3; _Args = {Toml::Array}; _First = int; _Rest = {double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:391:4, inlined from ‘constexpr std::__detail::__variant::_Variadic_union<_First, _Rest ...>::_Variadic_union(std::in_place_index_t<_Np>, _Args&& ...) [with long unsigned int _Np = 4; _Args = {Toml::Array}; _First = std::__cxx11::basic_string<char>; _Rest = {int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:391:4, inlined from ‘void std::_Construct(_Tp*, _Args&& ...) [with _Tp = __detail::__variant::_Variadic_union<__cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>; _Args = {const in_place_index_t<4>&, Toml::Array}]’ at /usr/include/c++/12/bits/stl_construct.h:119:7, inlined from ‘std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)> mutable [with auto:4 = Toml::Array; auto:5 = std::integral_constant<long unsigned int, 4>]’ at /usr/include/c++/12/variant:605:23, inlined from ‘constexpr _Res std::__invoke_impl(__invoke_other, _Fn&&, _Args&& ...) [with _Res = void; _Fn = __detail::__variant::_Move_ctor_base<false, __cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Args = {Toml::Array, integral_constant<long unsigned int, 4>}]’ at /usr/include/c++/12/bits/invoke.h:61:36, inlined from ‘constexpr typename std::__invoke_result<_Functor, _ArgTypes>::type std::__invoke(_Callable&&, _Args&& ...) [with _Callable = __detail::__variant::_Move_ctor_base<false, __cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Args = {Toml::Array, integral_constant<long unsigned int, 4>}]’ at /usr/include/c++/12/bits/invoke.h:96:40, 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 unsigned int, __indices ...> >::__visit_invoke(_Visitor&&, _Variants ...) [with _Result_type = std::__detail::__variant::__variant_idx_cookie; _Visitor = std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>&&; _Variants = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&}; long unsigned int ...__indices = {4}]’ at /usr/include/c++/12/variant:1020:17, inlined from ‘constexpr decltype(auto) std::__do_visit(_Visitor&&, _Variants&& ...) [with _Result_type = __detail::__variant::__variant_idx_cookie; _Visitor = __detail::__variant::_Move_ctor_base<false, __cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Variants = {variant<__cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>}]’ at /usr/include/c++/12/variant:1787:105, inlined from ‘constexpr decltype(auto) std::__do_visit(_Visitor&&, _Variants&& ...) [with _Result_type = __detail::__variant::__variant_idx_cookie; _Visitor = __detail::__variant::_Move_ctor_base<false, __cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Variants = {variant<__cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>}]’ at /usr/include/c++/12/variant:1729:5, inlined from ‘constexpr void std::__detail::__variant::__raw_idx_visit(_Visitor&&, _Variants&& ...) [with _Visitor = _Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Variants = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>}]’ at /usr/include/c++/12/variant:184:44, inlined from ‘std::__detail::__variant::_Move_ctor_base<<anonymous>, _Types>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<<anonymous>, _Types>&&) [with bool <anonymous> = false; _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:600:28, inlined from ‘std::__detail::__variant::_Copy_assign_base<<anonymous>, _Types>::_Copy_assign_base(std::__detail::__variant::_Copy_assign_base<<anonymous>, _Types>&&) [with bool <anonymous> = false; _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:665:7, inlined from ‘std::__detail::__variant::_Move_assign_base<<anonymous>, _Types>::_Move_assign_base(std::__detail::__variant::_Move_assign_base<<anonymous>, _Types>&&) [with bool <anonymous> = false; _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:719:7, inlined from ‘std::__detail::__variant::_Variant_base<_Types>::_Variant_base(std::__detail::__variant::_Variant_base<_Types>&&) [with _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:750:7, inlined from ‘std::variant<_Types>::variant(std::variant<_Types>&&) [with _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:1404:7, inlined from ‘void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Args = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>}; _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>]’ at /usr/include/c++/12/bits/new_allocator.h:175:4, inlined from ‘static void std::allocator_traits<std::allocator<_Tp1> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Args = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>}; _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>]’ at /usr/include/c++/12/bits/alloc_traits.h:516:17, inlined from ‘std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>}; _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Alloc = std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> >]’ at /usr/include/c++/12/bits/vector.tcc:117:30, inlined from ‘void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Alloc = std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> >]’ at /usr/include/c++/12/bits/stl_vector.h:1294:21, inlined from ‘Toml::Array::Array(const std::vector<double>&)’ at gcc_bug.cpp:19:37: /usr/include/c++/12/bits/stl_vector.h:106:49: warning: ‘*(std::_Vector_base<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> > >::_Vector_impl_data*)((char*)&<unnamed> + offsetof(std::value_type, std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Variant_base<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Move_assign_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Copy_assign_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Copy_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Variant_storage<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::_M_u)).std::_Vector_base<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> > >::_Vector_impl_data::_M_finish’ may be used uninitialized [-Wmaybe-uninitialized] 106 | : _M_start(__x._M_start), _M_finish(__x._M_finish), | ~~~~^~~~~~~~~ gcc_bug.cpp: In constructor ‘Toml::Array::Array(const std::vector<double>&)’: gcc_bug.cpp:19:37: note: ‘<anonymous>’ declared here 19 | this->data.push_back(elem); | ~~~~~~~~~~~~~~~~~~~~^~~~~~ In constructor ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl_data::_Vector_impl_data(std::_Vector_base<_Tp, _Alloc>::_Vector_impl_data&&) [with _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Alloc = std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> >]’, inlined from ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl(std::_Vector_base<_Tp, _Alloc>::_Vector_impl&&) [with _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Alloc = std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> >]’ at /usr/include/c++/12/bits/stl_vector.h:152:68, inlined from ‘std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::_Vector_base<_Tp, _Alloc>&&) [with _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Alloc = std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> >]’ at /usr/include/c++/12/bits/stl_vector.h:335:7, inlined from ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Alloc = std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> >]’ at /usr/include/c++/12/bits/stl_vector.h:615:7, inlined from ‘Toml::Array::Array(Toml::Array&&)’ at gcc_bug.cpp:11:11, inlined from ‘constexpr std::__detail::__variant::_Uninitialized<_Type, false>::_Uninitialized(std::in_place_index_t<0>, _Args&& ...) [with _Args = {Toml::Array}; _Type = Toml::Array]’ at /usr/include/c++/12/variant:283:4, inlined from ‘constexpr std::__detail::__variant::_Variadic_union<_First, _Rest ...>::_Variadic_union(std::in_place_index_t<0>, _Args&& ...) [with _Args = {Toml::Array}; _First = Toml::Array; _Rest = {}]’ at /usr/include/c++/12/variant:385:4, inlined from ‘constexpr std::__detail::__variant::_Variadic_union<_First, _Rest ...>::_Variadic_union(std::in_place_index_t<_Np>, _Args&& ...) [with long unsigned int _Np = 1; _Args = {Toml::Array}; _First = bool; _Rest = {Toml::Array}]’ at /usr/include/c++/12/variant:391:4, inlined from ‘constexpr std::__detail::__variant::_Variadic_union<_First, _Rest ...>::_Variadic_union(std::in_place_index_t<_Np>, _Args&& ...) [with long unsigned int _Np = 2; _Args = {Toml::Array}; _First = double; _Rest = {bool, Toml::Array}]’ at /usr/include/c++/12/variant:391:4, inlined from ‘constexpr std::__detail::__variant::_Variadic_union<_First, _Rest ...>::_Variadic_union(std::in_place_index_t<_Np>, _Args&& ...) [with long unsigned int _Np = 3; _Args = {Toml::Array}; _First = int; _Rest = {double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:391:4, inlined from ‘constexpr std::__detail::__variant::_Variadic_union<_First, _Rest ...>::_Variadic_union(std::in_place_index_t<_Np>, _Args&& ...) [with long unsigned int _Np = 4; _Args = {Toml::Array}; _First = std::__cxx11::basic_string<char>; _Rest = {int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:391:4, inlined from ‘void std::_Construct(_Tp*, _Args&& ...) [with _Tp = __detail::__variant::_Variadic_union<__cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>; _Args = {const in_place_index_t<4>&, Toml::Array}]’ at /usr/include/c++/12/bits/stl_construct.h:119:7, inlined from ‘std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)> mutable [with auto:4 = Toml::Array; auto:5 = std::integral_constant<long unsigned int, 4>]’ at /usr/include/c++/12/variant:605:23, inlined from ‘constexpr _Res std::__invoke_impl(__invoke_other, _Fn&&, _Args&& ...) [with _Res = void; _Fn = __detail::__variant::_Move_ctor_base<false, __cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Args = {Toml::Array, integral_constant<long unsigned int, 4>}]’ at /usr/include/c++/12/bits/invoke.h:61:36, inlined from ‘constexpr typename std::__invoke_result<_Functor, _ArgTypes>::type std::__invoke(_Callable&&, _Args&& ...) [with _Callable = __detail::__variant::_Move_ctor_base<false, __cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Args = {Toml::Array, integral_constant<long unsigned int, 4>}]’ at /usr/include/c++/12/bits/invoke.h:96:40, 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 unsigned int, __indices ...> >::__visit_invoke(_Visitor&&, _Variants ...) [with _Result_type = std::__detail::__variant::__variant_idx_cookie; _Visitor = std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>&&; _Variants = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&}; long unsigned int ...__indices = {4}]’ at /usr/include/c++/12/variant:1020:17, inlined from ‘constexpr decltype(auto) std::__do_visit(_Visitor&&, _Variants&& ...) [with _Result_type = __detail::__variant::__variant_idx_cookie; _Visitor = __detail::__variant::_Move_ctor_base<false, __cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Variants = {variant<__cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>}]’ at /usr/include/c++/12/variant:1787:105, inlined from ‘constexpr decltype(auto) std::__do_visit(_Visitor&&, _Variants&& ...) [with _Result_type = __detail::__variant::__variant_idx_cookie; _Visitor = __detail::__variant::_Move_ctor_base<false, __cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Variants = {variant<__cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, double, bool, Toml::Array>}]’ at /usr/include/c++/12/variant:1729:5, inlined from ‘constexpr void std::__detail::__variant::__raw_idx_visit(_Visitor&&, _Variants&& ...) [with _Visitor = _Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>&&)::<lambda(auto:4&&, auto:5)>; _Variants = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>}]’ at /usr/include/c++/12/variant:184:44, inlined from ‘std::__detail::__variant::_Move_ctor_base<<anonymous>, _Types>::_Move_ctor_base(std::__detail::__variant::_Move_ctor_base<<anonymous>, _Types>&&) [with bool <anonymous> = false; _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:600:28, inlined from ‘std::__detail::__variant::_Copy_assign_base<<anonymous>, _Types>::_Copy_assign_base(std::__detail::__variant::_Copy_assign_base<<anonymous>, _Types>&&) [with bool <anonymous> = false; _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:665:7, inlined from ‘std::__detail::__variant::_Move_assign_base<<anonymous>, _Types>::_Move_assign_base(std::__detail::__variant::_Move_assign_base<<anonymous>, _Types>&&) [with bool <anonymous> = false; _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:719:7, inlined from ‘std::__detail::__variant::_Variant_base<_Types>::_Variant_base(std::__detail::__variant::_Variant_base<_Types>&&) [with _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:750:7, inlined from ‘std::variant<_Types>::variant(std::variant<_Types>&&) [with _Types = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array}]’ at /usr/include/c++/12/variant:1404:7, inlined from ‘void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Args = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>}; _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>]’ at /usr/include/c++/12/bits/new_allocator.h:175:4, inlined from ‘static void std::allocator_traits<std::allocator<_Tp1> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Args = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>}; _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>]’ at /usr/include/c++/12/bits/alloc_traits.h:516:17, inlined from ‘std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>}; _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Alloc = std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> >]’ at /usr/include/c++/12/bits/vector.tcc:117:30, inlined from ‘void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>; _Alloc = std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> >]’ at /usr/include/c++/12/bits/stl_vector.h:1294:21, inlined from ‘Toml::Array::Array(const std::vector<double>&)’ at gcc_bug.cpp:19:37: /usr/include/c++/12/bits/stl_vector.h:107:33: warning: ‘*(std::_Vector_base<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> > >::_Vector_impl_data*)((char*)&<unnamed> + offsetof(std::value_type, std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Variant_base<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Move_assign_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Copy_assign_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Move_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Copy_ctor_base<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::<unnamed>.std::__detail::__variant::_Variant_storage<false, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>::_M_u)).std::_Vector_base<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array>, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, double, bool, Toml::Array> > >::_Vector_impl_data::_M_end_of_storage’ may be used uninitialized [-Wmaybe-uninitialized] 107 | _M_end_of_storage(__x._M_end_of_storage) | ~~~~^~~~~~~~~~~~~~~~~ gcc_bug.cpp: In constructor ‘Toml::Array::Array(const std::vector<double>&)’: gcc_bug.cpp:19:37: note: ‘<anonymous>’ declared here 19 | this->data.push_back(elem); | ~~~~~~~~~~~~~~~~~~~~^~~~~~ COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++17' '-Wall' '-Wextra' '-O2' '-o' 'gcc_bug' '-shared-libgcc' '-mtune=generic' '-march=x86-64' as -v --64 -o gcc_bug.o gcc_bug.s GNU assembler version 2.39 (x86_64-linux-gnu) using BFD version (GNU Binutils for Debian) 2.39 COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/12/:/usr/lib/gcc/x86_64-linux-gnu/12/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/12/:/usr/lib/gcc/x86_64-linux-gnu/ LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12/:/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/12/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/12/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++17' '-Wall' '-Wextra' '-O2' '-o' 'gcc_bug' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'gcc_bug.' /usr/lib/gcc/x86_64-linux-gnu/12/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/12/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/12/lto-wrapper -plugin-opt=-fresolution=gcc_bug.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -o gcc_bug /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/12/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/12 -L/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/12/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/12/../../.. gcc_bug.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/12/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/crtn.o COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++17' '-Wall' '-Wextra' '-O2' '-o' 'gcc_bug' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'gcc_bug.' ```