https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77322
Bug ID: 77322 Summary: [C++11] std::function::swap should be noexcept. Product: gcc Version: 6.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: ralph.tandetzky at gmail dot com Target Milestone: --- The C++11, C++14 and C++17 standard require, that std::function<Signature>::swap() be noexcept. However, the following program does not compile: #include <functional> int main() { std::function<void()> f; static_assert( noexcept( f.swap(f) ), "" ); } This is the error message: main.cpp: In function 'int main()': main.cpp:6:5: error: static assertion failed static_assert( noexcept( f.swap(f) ), "" ); ^~~~~~~~~~~~~ By the way, clang does it right. This bug should be very simple to fix. This concerns all GCC versions that support C++11 from version 4.7 (or maybe earlier) until 6.1 (or maybe later).