[Bug c++/37204] New: reinterpret_cast<T&&>(v) incorrectly yields an lvalue

gcc-bugzilla at contacts dot eelis dot net gcc-bugzilla@gcc.gnu.org
Fri Aug 22 20:30:00 GMT 2008


Consider:

  #include <iostream>
  void f(int &) { std::cout << "lvalue\n"; }
  void f(int &&) { std::cout << "rvalue\n"; }
  int main() { int x(3); f(reinterpret_cast<int&&>(x)); }

This /should/ output "rvalue", but it outputs "lvalue" instead (when compiled
with -std=c++0x).

In 5.2.10p1, n2691 (the most recent C++0x draft) states w.r.t.
reinterpret_cast<T>(v):

  "If T is an lvalue reference type, the result is an lvalue; otherwise, the
result is an rvalue"


-- 
           Summary: reinterpret_cast<T&&>(v) incorrectly yields an lvalue
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc-bugzilla at contacts dot eelis dot net


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



More information about the Gcc-bugs mailing list