public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34022]  New: Rvalue references and std::forward() broken with built-in types
@ 2007-11-08  1:26 eric dot niebler at gmail dot com
  2007-11-08  1:59 ` [Bug c++/34022] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: eric dot niebler at gmail dot com @ 2007-11-08  1:26 UTC (permalink / raw)
  To: gcc-bugs

Compile the following program with -std=c++0x. In my understanding, the two
printed addresses should be the same. They are when I invoke foo() with a class
type, but not with built-in types like char.

This is with the latest g++ built from SVN.

#include <cstdio>
#include <utility>

template<typename T> void bar(T &&t)
{
    std::printf("%p\n", &t);
}

template<typename T> void foo(T &&t)
{
    std::printf("%p\n", &t);
    bar(std::forward<T>(t));
}

struct S {};

int main()
{
    foo('a'); // WRONG, prints 2 different addresses
    foo(S()); // OK, prints the same address twice
}


-- 
           Summary: Rvalue references and std::forward() broken with built-
                    in types
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: eric dot niebler at gmail dot com


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


^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <bug-34022-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2010-11-30 20:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-08  1:26 [Bug c++/34022] New: Rvalue references and std::forward() broken with built-in types eric dot niebler at gmail dot com
2007-11-08  1:59 ` [Bug c++/34022] " pinskia at gcc dot gnu dot org
2007-11-08  2:01 ` pinskia at gcc dot gnu dot org
2007-11-16 20:11 ` [Bug c++/34022] C++0x: rvalue " dgregor at gcc dot gnu dot org
2007-11-18 14:15 ` dgregor at gcc dot gnu dot org
2008-03-19 13:12 ` dgregor at gcc dot gnu dot org
2008-12-02 17:54 ` jason at gcc dot gnu dot org
2009-06-02 14:14 ` jwakely dot gcc at gmail dot com
2009-08-01  9:45 ` paolo dot carlini at oracle dot com
     [not found] <bug-34022-4@http.gcc.gnu.org/bugzilla/>
2010-11-30 20:56 ` redi at gcc dot gnu.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).