According to [dcl.init.ref], p5 of the latest working paper (N2960), 

    A reference to type “cv1 T1” is initialized by an expression of type
    “cv2 T2” as follows:
    ...

    ...the reference shall be an lvalue reference to a non-volatile const
    type (i.e., cv1 shall be const), or the reference shall be an rvalue
    reference and the initializer expression shall be an rvalue.

The following ill-formed program is accepted by gcc 4.4.1:

$    cat u.cpp && gcc -dumpversion \
  && gcc -W -Wall -c -std=c++0x u.cpp && echo FAIL
extern int &ir;
int &&irr = ir;   // ill-formed
4.4.1
FAIL


-- 
           Summary: missing diagnostic on an ill-formed  rvalue reference
                    initialization
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: msebor at gmail dot com


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

Reply via email to