Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Remove 'boost::optional'-related false positive -Wmaybe-uninitialized warnings on GCC compiler #15292
#14711 introduced some warnings when building with gcc compiler.
This PR removes these warnings.
I would prefer not to make these changes since I think they make the code less readable, are only applicable to older buggy versions of gcc, and just avoid warnings not errors.
But I will add my utACK 595b62f since the changes do look safe, and other people might want them.
I wonder what would happen if you tried to replace:
Optional<int> height = nullopt;
I think a change like that would be more readable.
I am using gcc 7.3.0 (both Linux Mint 19.1 and Ubuntu Bionic). Warnings are still present.
I've tried this approach while working on this PR.
I think "The default constructor of optional creates an uninitialized optional object." may be misleading as default-constructed values are valid, e.g..
Incidentally here's the doc where boost recommends this fix.