https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80451
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ville at gcc dot gnu.org --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- This is due to the resolution of http://cplusplus.github.io/LWG/lwg-defects.html#2451 #include <experimental/optional> class B { public: B(const B&) = delete; B(B&&) { } B& operator=(const B&) = delete; B& operator=(B&&) = delete; B() noexcept {}; }; inline std::experimental::optional<B> meal() { B b; return b; } int main() { auto k = meal(); } The example tries to construct optional<B> from an lvalue of type B, which would require a copy, which is deleted. Doing "return std::move(b);" would work.