Fails to build with GCC 15
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 384
- Forks
- 96
- PR merge metrics
- No merged PRs in 30d
Description
mapbox variant fails build with GCC 15 as reported in [Debian Bug #1114197](https://bugs.debian.org/1114197):
```
[...]
/usr/include/c++/15/bits/char_traits.h:352:16: error: '((const std::char_traits::char_type*)((char*)&temp + offsetof(boost::variant, std::allocator > >,boo
st::variant, std::allocator > >::storage_.boost::aligned_storage<32, 8>::.boost::detail::aligned_storage::aligned_storage_imp<32, 8>::data_)))[16]' may
be used uninitialized [-Werror=maybe-uninitialized]
352 | __c1 = __c2;
| ^~~~
In file included from /usr/include/boost/variant.hpp:17,
from test/bench_variant.cpp:12:
/usr/include/boost/variant/variant.hpp: In function 'void run_boost_test(std::size_t)':
/usr/include/boost/variant/variant.hpp:2107:21: note: 'temp' declared here
2107 | variant temp(rhs);
| ^~~~
[...]
/usr/include/c++/15/bits/basic_string.h:1165:19: error: '*(const std::__cxx11::basic_string, std::allocator >*)((char*)&temp + offsetof(boost::variant, std::allocator > >,boost::variant, std::allocator > >::storage_.boost::aligned_storage<32, 8>::.boost::detail::aligned_storage
::aligned_storage_imp<32, 8>::data_)).std::__cxx11::basic_string::_M_string_length' may be used uninitialized [-Werror=maybe-uninitialized]
1165 | size_type __sz = _M_string_length;
| ^~~~
/usr/include/boost/variant/variant.hpp: In function 'void run_boost_test(std::size_t)':
/usr/include/boost/variant/variant.hpp:2107:21: note: 'temp' declared here
2107 | variant temp(rhs);
| ^~~~
[...]
/usr/include/c++/15/bits/basic_string.h:992:24: error: '*(std::__cxx11::basic_string, std::allocator >*)((char*)&temp + offsetof(boost::variant, std::allocator > >,boost::variant, std::allocator > >::storage_.boost::aligned_storage<32, 8>::.boost::detail::aligned_storage::align
ed_storage_imp<32, 8>::data_)).std::__cxx11::basic_string::.std::__cxx11::basic_string::::_M_allocated_capacity' may be used uninitialized [-Werror=maybe-uninitialized]
992 | _M_capacity(__str._M_allocated_capacity);
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/boost/variant/variant.hpp: In function 'void run_boost_test(std::size_t)':
/usr/include/boost/variant/variant.hpp:2107:21: note: 'temp' declared here
2107 | variant temp(rhs);
| ^~~~
[...]
/usr/include/c++/15/bits/basic_string.h:992:24: error: '*(std::__cxx11::basic_string, std::allocator >*)((char*)&temp + offsetof(boost::variant, std::allocator > >,boost::variant, std::allocator > >::storage_.boost::aligned_storage<32, 8>::.boost::detail::aligned_storage::align
ed_storage_imp<32, 8>::data_)).std::__cxx11::basic_string::.std::__cxx11::basic_string::::_M_allocated_capacity' may be used uninitialized [-Werror=maybe-uninitialized]
992 | _M_capacity(__str._M_allocated_capacity);
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/boost/variant/variant.hpp: In function 'void run_boost_test(std::size_t)':
/usr/include/boost/variant/variant.hpp:2107:21: note: 'temp' declared here
2107 | variant temp(rhs);
| ^~~~
[...]
/usr/include/c++/15/bits/basic_string.h:282:17: error: '*(const std::__cxx11::basic_string, std::allocator >*)((char*)&temp + offsetof(boost::variant, std::allocator > >,boost::variant, std::allocator > >::storage_.boost::aligned_storage<32, 8>::.boost::detail::aligned_storage:
:aligned_storage_imp<32, 8>::data_)).std::__cxx11::basic_string::_M_string_length' may be used uninitialized [-Werror=maybe-uninitialized]
282 | if (_M_string_length > _S_local_capacity)
| ^~~~~~~~~~~~~~~~
/usr/include/boost/variant/variant.hpp: In function 'void run_boost_test(std::size_t)':
/usr/include/boost/variant/variant.hpp:2107:21: note: 'temp' declared here
2107 | variant temp(rhs);
| ^~~~
[...]
/usr/include/c++/15/bits/basic_string.h:282:17: error: '*(const std::__cxx11::basic_string, std::allocator >*)((char*)&temp + offsetof(boost::variant, std::allocator > >,boost::variant, std::allocator > >::storage_.boost::aligned_storage<32, 8>::.boost::detail::aligned_storage:
:aligned_storage_imp<32, 8>::data_)).std::__cxx11::basic_string::_M_string_length' may be used uninitialized [-Werror=maybe-uninitialized]
282 | if (_M_string_length > _S_local_capacity)
| ^~~~~~~~~~~~~~~~
/usr/include/boost/variant/variant.hpp: In function 'void run_boost_test(std::size_t)':
/usr/include/boost/variant/variant.hpp:2107:21: note: 'temp' declared here
2107 | variant temp(rhs);
| ^~~~
[...]
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the GCC 15 failure for test/bench_variant.cpp and compare it with Debian Bug #1114197. Trace whether the diagnostic comes from the project or the included Boost headers; done means the project builds successfully with GCC 15 without the reported -Werror=maybe-uninitialized failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100