From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32129 invoked by alias); 27 May 2012 11:20:15 -0000 Received: (qmail 32117 invoked by uid 22791); 27 May 2012 11:20:13 -0000 X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_CX X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 27 May 2012 11:19:49 +0000 From: "vlukas at gmx dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/53497] New: Partial ordering of function templates does not order lvalue/rvalue references correctly Date: Sun, 27 May 2012 12:00: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: vlukas at gmx dot de 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" Content-Transfer-Encoding: quoted-printable 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: 2012-05/txt/msg02587.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D53497 Bug #: 53497 Summary: Partial ordering of function templates does not order lvalue/rvalue references correctly Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: vlukas@gmx.de Following defect report 1164 (http://open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#1164) a rule was added to partial ordering of function templates, so that parameters declare= d as lvalue-references are considered more specialized than those declared as rvalue-references. GCC does not implement this, i.e. ----------------------------------------------- template void t(T&); template void t(T&&); int x; void f() { t(x); } ----------------------------------------------- is rejected by GCC 4.7.0 and a 4.8.0 prerelease. Diagnostic for the latter = is: --------------------------------------------------------------------- c++ -std=3Dc++11 -c ref_binding.cc ref_binding.cc: In function =E2=80=98void f()=E2=80=99: ref_binding.cc:8:6: error: call of overloaded =E2=80=98t(int&)=E2=80=99 is = ambiguous t(x); ^ ref_binding.cc:8:6: note: candidates are: ref_binding.cc:2:6: note: void t(T&) [with T =3D int] void t(T&); ^ ref_binding.cc:4:6: note: void t(T&&) [with T =3D int&] void t(T&&); ^ --------------------------------------------------------------------- Full compiler identification: --------------------------------------------------------------------- c++ -v Using built-in specs. COLLECT_GCC=3D/home/lima/vanilla_installs/gcc_and_tools/bin/c++ COLLECT_LTO_WRAPPER=3D/home/lima/vanilla_installs/gcc_and_tools/lib/gcc/x86= _64-unknown-linux-gnu/4.8.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc_svn/configure --prefix=3D/home/lima/vanilla_installs/gcc_and_tools --enable-threads --enable-__cxa_atexit --enable-languages=3Dc,c++ --enable-version-specific-runtime-libs --disable-multilib Thread model: posix gcc version 4.8.0 20120526 (experimental) (GCC) -------------------------------------------------------------------- DR 1164 appears to have made it into the standard, it is marked FDIS and I = find it in both the N3290 and N3376 drafts of C++.