https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99058
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- C++17 support isn't stable until GCC 9 so there is no guarantee of compatibility between 7 and 8 or 8 and 9. That applies to the entire library (and language features) not just std::optional.