public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53497] New: Partial ordering of function templates does not order lvalue/rvalue references correctly
@ 2012-05-27 12:00 vlukas at gmx dot de
  2013-05-05  9:53 ` [Bug c++/53497] " paolo.carlini at oracle dot com
  0 siblings, 1 reply; 2+ messages in thread
From: vlukas at gmx dot de @ 2012-05-27 12:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53497

             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 declared as
lvalue-references are considered more specialized than those declared as
rvalue-references. GCC does not implement this, i.e.
-----------------------------------------------
template<typename T>
void t(T&);
template<typename T>
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=c++11 -c ref_binding.cc
ref_binding.cc: In function ‘void f()’:
ref_binding.cc:8:6: error: call of overloaded ‘t(int&)’ is ambiguous
   t(x);
      ^
ref_binding.cc:8:6: note: candidates are:
ref_binding.cc:2:6: note: void t(T&) [with T = int]
 void t(T&);
      ^
ref_binding.cc:4:6: note: void t(T&&) [with T = int&]
 void t(T&&);
      ^
---------------------------------------------------------------------

Full compiler identification:
---------------------------------------------------------------------
c++ -v
Using built-in specs.
COLLECT_GCC=/home/lima/vanilla_installs/gcc_and_tools/bin/c++
COLLECT_LTO_WRAPPER=/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=/home/lima/vanilla_installs/gcc_and_tools --enable-threads
--enable-__cxa_atexit --enable-languages=c,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++.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/53497] Partial ordering of function templates does not order lvalue/rvalue references correctly
  2012-05-27 12:00 [Bug c++/53497] New: Partial ordering of function templates does not order lvalue/rvalue references correctly vlukas at gmx dot de
@ 2013-05-05  9:53 ` paolo.carlini at oracle dot com
  0 siblings, 0 replies; 2+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-05-05  9:53 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53497

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-05-05 09:53:27 UTC ---
Dup.

*** This bug has been marked as a duplicate of bug 57172 ***


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-05  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-27 12:00 [Bug c++/53497] New: Partial ordering of function templates does not order lvalue/rvalue references correctly vlukas at gmx dot de
2013-05-05  9:53 ` [Bug c++/53497] " paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).