public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57172] New: [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T&
@ 2013-05-04 19:38 daniel.kruegler at googlemail dot com
  2013-05-04 21:27 ` [Bug c++/57172] " glisse at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-05-04 19:38 UTC (permalink / raw)
  To: gcc-bugs


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<typename T> int f(T&){}
template<typename T> 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.


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

* [Bug c++/57172] [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T&
  2013-05-04 19:38 [Bug c++/57172] New: [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T& daniel.kruegler at googlemail dot com
@ 2013-05-04 21:27 ` glisse at gcc dot gnu.org
  2013-05-05  9:50 ` vlukas at gmx dot de
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-05-04 21:27 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> 2013-05-04 21:27:02 UTC ---
Created attachment 30031
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30031
rough untested patch

This patch (missing at least testing and an update of the comments) seems to
help for this specific case.


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

* [Bug c++/57172] [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T&
  2013-05-04 19:38 [Bug c++/57172] New: [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T& daniel.kruegler at googlemail dot com
  2013-05-04 21:27 ` [Bug c++/57172] " glisse at gcc dot gnu.org
@ 2013-05-05  9:50 ` vlukas at gmx dot de
  2013-05-05  9:53 ` paolo.carlini at oracle dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: vlukas at gmx dot de @ 2013-05-05  9:50 UTC (permalink / raw)
  To: gcc-bugs


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

vlukas at gmx dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vlukas at gmx dot de

--- Comment #2 from vlukas at gmx dot de 2013-05-05 09:49:54 UTC ---
This looks like a duplicate of PR 53497 too me.


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

* [Bug c++/57172] [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T&
  2013-05-04 19:38 [Bug c++/57172] New: [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T& daniel.kruegler at googlemail dot com
  2013-05-04 21:27 ` [Bug c++/57172] " glisse at gcc dot gnu.org
  2013-05-05  9:50 ` vlukas at gmx dot de
@ 2013-05-05  9:53 ` paolo.carlini at oracle dot com
  2013-06-08 13:01 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ 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=57172

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-05-05 09:53:27 UTC ---
*** Bug 53497 has been marked as a duplicate of this bug. ***


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

* [Bug c++/57172] [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T&
  2013-05-04 19:38 [Bug c++/57172] New: [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T& daniel.kruegler at googlemail dot com
                   ` (2 preceding siblings ...)
  2013-05-05  9:53 ` paolo.carlini at oracle dot com
@ 2013-06-08 13:01 ` redi at gcc dot gnu.org
  2013-06-16 10:14 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2013-06-08 13:01 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-06-08
     Ever confirmed|0                           |1


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

* [Bug c++/57172] [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T&
  2013-05-04 19:38 [Bug c++/57172] New: [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T& daniel.kruegler at googlemail dot com
                   ` (3 preceding siblings ...)
  2013-06-08 13:01 ` redi at gcc dot gnu.org
@ 2013-06-16 10:14 ` paolo.carlini at oracle dot com
  2013-06-16 10:22 ` glisse at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-16 10:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |glisse at gcc dot gnu.org

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Patch passes testing. Are you going to send it to the mailing list?


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

* [Bug c++/57172] [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T&
  2013-05-04 19:38 [Bug c++/57172] New: [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T& daniel.kruegler at googlemail dot com
                   ` (4 preceding siblings ...)
  2013-06-16 10:14 ` paolo.carlini at oracle dot com
@ 2013-06-16 10:22 ` glisse at gcc dot gnu.org
  2013-06-16 12:19 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-06-16 10:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Marc Glisse <glisse at gcc dot gnu.org> ---
Not soon, sorry (I am in Brazil). Feel free to take it up (or use a different
approach).


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

* [Bug c++/57172] [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T&
  2013-05-04 19:38 [Bug c++/57172] New: [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T& daniel.kruegler at googlemail dot com
                   ` (5 preceding siblings ...)
  2013-06-16 10:22 ` glisse at gcc dot gnu.org
@ 2013-06-16 12:19 ` paolo.carlini at oracle dot com
  2013-06-27 11:43 ` glisse at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-16 12:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Oh well, it can certainly wait a bit, just let's not forget about it (patches
only attached to bug reports make me slightly nervous) ... or you can and it
over to Alex (Oliva) ;)


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

* [Bug c++/57172] [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T&
  2013-05-04 19:38 [Bug c++/57172] New: [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T& daniel.kruegler at googlemail dot com
                   ` (6 preceding siblings ...)
  2013-06-16 12:19 ` paolo.carlini at oracle dot com
@ 2013-06-27 11:43 ` glisse at gcc dot gnu.org
  2014-01-19 19:03 ` glisse at gcc dot gnu.org
  2014-01-21 17:03 ` seezer+gcc at roath dot org
  9 siblings, 0 replies; 11+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-06-27 11:43 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |glisse at gcc dot gnu.org

--- Comment #7 from Marc Glisse <glisse at gcc dot gnu.org> ---
r200463 | glisse | 2013-06-27 13:34:48 +0200 (Thu, 27 Jun 2013) | 11 lines

2013-06-27  Marc Glisse  <marc.glisse@inria.fr>

        PR c++/57172
gcc/cp/
        * pt.c (more_specialized_fn): If both arguments are references,
        give priority to an lvalue.

gcc/testsuite/
        * g++.dg/cpp0x/pr57172.C: New testcase.


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

* [Bug c++/57172] [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T&
  2013-05-04 19:38 [Bug c++/57172] New: [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T& daniel.kruegler at googlemail dot com
                   ` (7 preceding siblings ...)
  2013-06-27 11:43 ` glisse at gcc dot gnu.org
@ 2014-01-19 19:03 ` glisse at gcc dot gnu.org
  2014-01-21 17:03 ` seezer+gcc at roath dot org
  9 siblings, 0 replies; 11+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-01-19 19:03 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |leonid at volnitsky dot com

--- Comment #8 from Marc Glisse <glisse at gcc dot gnu.org> ---
*** Bug 54425 has been marked as a duplicate of this bug. ***


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

* [Bug c++/57172] [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T&
  2013-05-04 19:38 [Bug c++/57172] New: [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T& daniel.kruegler at googlemail dot com
                   ` (8 preceding siblings ...)
  2014-01-19 19:03 ` glisse at gcc dot gnu.org
@ 2014-01-21 17:03 ` seezer+gcc at roath dot org
  9 siblings, 0 replies; 11+ messages in thread
From: seezer+gcc at roath dot org @ 2014-01-21 17:03 UTC (permalink / raw)
  To: gcc-bugs

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

sego <seezer+gcc at roath dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |seezer+gcc at roath dot org

--- Comment #9 from sego <seezer+gcc at roath dot org> ---
Is there any chance to get that fixed in 4.8, too?


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

end of thread, other threads:[~2014-01-21 17:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-04 19:38 [Bug c++/57172] New: [C++11][DR 1164] Template overload resolution ambiguous for T&& versus T& daniel.kruegler at googlemail dot com
2013-05-04 21:27 ` [Bug c++/57172] " glisse at gcc dot gnu.org
2013-05-05  9:50 ` vlukas at gmx dot de
2013-05-05  9:53 ` paolo.carlini at oracle dot com
2013-06-08 13:01 ` redi at gcc dot gnu.org
2013-06-16 10:14 ` paolo.carlini at oracle dot com
2013-06-16 10:22 ` glisse at gcc dot gnu.org
2013-06-16 12:19 ` paolo.carlini at oracle dot com
2013-06-27 11:43 ` glisse at gcc dot gnu.org
2014-01-19 19:03 ` glisse at gcc dot gnu.org
2014-01-21 17:03 ` seezer+gcc at roath dot org

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).