https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80493
Bug ID: 80493 Summary: std::experimental::optional::swap is ill formed Product: gcc Version: 6.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: a...@cloudius-systems.com Target Milestone: --- From std::experimental::optional: void swap(optional& __other) noexcept(is_nothrow_move_constructible<_Tp>() && noexcept(swap(declval<_Tp&>(), declval<_Tp&>()))) { The operand to the noexcept operator calls swap(T&, T&); but that is hidden by optional::swap(optional&). Clang correctly rejects this code, but g++ accepts it.