https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85642
Bug ID: 85642 Summary: Wrong implicit exception-specification with std::optional Product: gcc Version: 8.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: duarte at scylladb dot com Target Milestone: --- Apologies if this has already been reported, but I couldn't find a matching report. Consider the following program: #include <optional> struct Y { int i; Y() noexcept = default; Y(Y&&) noexcept = default; }; class X final { std::optional<Y> _permit; X() noexcept = default; public: static X make() { return X(); } }; int main() { X::make(); return 1; } It fails with the following error message on GCC 8.0.1 and GCC 8.1: <source>: In static member function 'static X X::make()': <source>:14:18: error: use of deleted function 'constexpr X::X()' return X(); ^ <source>:11:5: note: 'constexpr X::X() noexcept' is implicitly deleted because its exception-specification does not match the implicit exception-specification '' X() noexcept = default; ^ Compiler returned: 1 It compiles fine on GCC 7.3, which I believe is the correct result. Godbolt: https://godbolt.org/g/Y2hCHZ