From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15534 invoked by alias); 25 Jan 2013 19:15:53 -0000 Received: (qmail 15201 invoked by uid 48); 25 Jan 2013 19:15:36 -0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/56112] New: [4.8 Regression] cannot create unordered_map from range of types convertible to value_type Date: Fri, 25 Jan 2013 19:15:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-01/txt/msg02390.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56112 Bug #: 56112 Summary: [4.8 Regression] cannot create unordered_map from range of types convertible to value_type Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: redi@gcc.gnu.org #include struct S { operator std::pair() const { return {}; } }; int main() { S s[1]; std::unordered_map m(s, s+1); // error std::pair p = *s; // OK m.insert(s, s+1); // OK } This is valid (value_type is EmplaceConstructible into the container from s[0]) but it fails to compile because of the change to use std::__detail::_Select1st instead of std::_Select1st The template argument for _Select1st::operator() cannot be deduced from the object of type S. The problem boils down to this: #include struct S { operator std::pair() const { return {}; } }; void f() { S s; std::get<0>(s); } This is not valid, but the range constructors of unordered_map and unordered_multimap assume using std::get<0> on the iterator's value type will work, which is not a valid assumption.