https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77537
Bug ID: 77537 Summary: pair constructors do not properly SFINAE Product: gcc Version: 6.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: Casey at Carter dot net Target Milestone: --- Created attachment 39586 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39586&action=edit Patch Both static_asserts in this program fail: #include <utility> #include <type_traits> struct moveonly { moveonly() = default; moveonly(moveonly&&) = default; }; template<class T> using P = std::pair<int, T>; static_assert(!std::is_constructible<P<moveonly>, int, moveonly&>::value, "FAIL"); static_assert(!std::is_constructible<P<moveonly>, P<moveonly&>>::value, "FAIL"); Because the resolution of PR 70437 makes many of the pair constructors inappropriately participate in overload resolution. Attached patch is a poorly-tested fix. (It works for this repro, and the repro in 70437, but caveat emptor.)