This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/77537] New: pair constructors do not properly SFINAE
- From: "Casey at Carter dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 08 Sep 2016 23:55:45 +0000
- Subject: [Bug libstdc++/77537] New: pair constructors do not properly SFINAE
- Auto-submitted: auto-generated
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.)