Consider:

  int && f();
  void g() { &(f()); }

GCC accepts, but shouldn't, because by 5.3.1p2 (in n2461) the operand of unary
& must be an lvalue, and by 5p6 (f()) is an rvalue.

I'm using g++ (GCC) 4.3.0 20080106 (experimental).


-- 
           Summary: Taking address of result of calling function returning
                    rvalue reference should not compile.
           Product: gcc
           Version: 4.3.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=35153

Reply via email to