From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17423 invoked by alias); 4 May 2013 19:38:39 -0000 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 Received: (qmail 17389 invoked by uid 48); 4 May 2013 19:38:34 -0000 From: "daniel.kruegler at googlemail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/57172] New: [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T& Date: Sat, 04 May 2013 19:38:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: daniel.kruegler at googlemail dot com 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 X-SW-Source: 2013-05/txt/msg00291.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57172 Bug #: 57172 Summary: [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T& Classification: Unclassified Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: daniel.kruegler@googlemail.com The following code is rejected by gcc 4.9.0 20130428 (experimental) using the compiler flags -std=c++11 -Wall -pedantic-errors //----------------------------- template int f(T&){} template int f(T&&); int i; int j = f(i); //----------------------------- "main.cpp|4|error: call of overloaded 'f(int&)' is ambiguous| main.cpp|4|note: candidates are:| main.cpp|1|note: int f(T&) [with T = int]| main.cpp|2|note: int f(T&&) [with T = int&]|" This example was relevant for http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1164 and the core language has been adapted to make it well-formed as described by [temp.deduct.partial] p9 b1. The compiler should select the first overload here.