public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/36816]  New: error deducing template argument taking the address of rvalue reference template
@ 2008-07-12 22:36 sebor at roguewave dot com
  2009-10-07 21:27 ` [Bug c++/36816] [c++0x] " jason at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: sebor at roguewave dot com @ 2008-07-12 22:36 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1490 bytes --]

Gcc 4.3.0 diagnoses the line marked "<<< error? <<<" in the program below.
I'd like to believe the program is well-formed and that the compiler should
be able to correctly deduce the template arguments from the initialed
expression without explicitly providing the template argument list.

template <class T> void f (T) { }
template <class T> void g (T&) { }
template <class T> void h (T&&) { }

int main ()
{
    { void (*pf)(int)    = &f; }         // okay
    { void (*pf)(int&)   = &f; }         // okay
    { void (*pf)(int&&)  = &f; }         // okay

    { void (*pf)(int&)   = &g; }         // okay

    { void (*pf)(int&&)  = &h; }         // okay
    { void (*pf)(int&)   = &h; }         // <<< error? <<<
    { void (*pf)(int&)   = &h<int&>; }   // okay
    // { void (*pf)(int&&)  = &h<int&>; }   // error!
    // { void (*pf)(int&&&) = &h<int&>; }   // error!
}
t.cpp: In function ‘int main()’:
t.cpp:14: error: no matches converting function ‘h’ to type ‘void (*)(int&)’
t.cpp:3: error: candidates are: template<class T> void h(T&&)


-- 
           Summary: error deducing template argument taking the address of
                    rvalue reference template
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com


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


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

* [Bug c++/36816] [c++0x] error deducing template argument taking the address of rvalue reference template
  2008-07-12 22:36 [Bug c++/36816] New: error deducing template argument taking the address of rvalue reference template sebor at roguewave dot com
@ 2009-10-07 21:27 ` jason at gcc dot gnu dot org
  2009-10-08 16:10 ` jason at gcc dot gnu dot org
  2009-10-08 17:48 ` jason at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-10-07 21:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jason at gcc dot gnu dot org  2009-10-07 21:27 -------
This is core issue 873,
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#873


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-10-07 21:27:37
               date|                            |


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


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

* [Bug c++/36816] [c++0x] error deducing template argument taking the address of rvalue reference template
  2008-07-12 22:36 [Bug c++/36816] New: error deducing template argument taking the address of rvalue reference template sebor at roguewave dot com
  2009-10-07 21:27 ` [Bug c++/36816] [c++0x] " jason at gcc dot gnu dot org
@ 2009-10-08 16:10 ` jason at gcc dot gnu dot org
  2009-10-08 17:48 ` jason at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-10-08 16:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jason at gcc dot gnu dot org  2009-10-08 16:09 -------
Subject: Bug 36816

Author: jason
Date: Thu Oct  8 16:09:31 2009
New Revision: 152565

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152565
Log:
        PR c++/36816
        * pt.c (maybe_adjust_types_for_deduction): Do rvalue ref adjustment
        even when DEDUCE_EXACT.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/rv-deduce.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/36816] [c++0x] error deducing template argument taking the address of rvalue reference template
  2008-07-12 22:36 [Bug c++/36816] New: error deducing template argument taking the address of rvalue reference template sebor at roguewave dot com
  2009-10-07 21:27 ` [Bug c++/36816] [c++0x] " jason at gcc dot gnu dot org
  2009-10-08 16:10 ` jason at gcc dot gnu dot org
@ 2009-10-08 17:48 ` jason at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-10-08 17:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jason at gcc dot gnu dot org  2009-10-08 17:48 -------
Fixed for 4.5.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2009-10-08 17:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-12 22:36 [Bug c++/36816] New: error deducing template argument taking the address of rvalue reference template sebor at roguewave dot com
2009-10-07 21:27 ` [Bug c++/36816] [c++0x] " jason at gcc dot gnu dot org
2009-10-08 16:10 ` jason at gcc dot gnu dot org
2009-10-08 17:48 ` jason at gcc dot gnu 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).