From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3052 invoked by alias); 8 Aug 2011 20:56:17 -0000 Received: (qmail 3039 invoked by uid 22791); 8 Aug 2011 20:56:17 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_CX,TW_GC,TW_IB X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 08 Aug 2011 20:56:03 +0000 From: "akrzemi1 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: akrzemi1 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Date: Mon, 08 Aug 2011 20:56:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-08/txt/msg00890.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D50025 Summary: C++0x initialization syntax doesn't work for class members of reference type Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: akrzemi1@gmail.com The following code does not compile although I expect it to: /// BEGIN CODE /// #include struct S {}; struct C { S & mc2; S && mc3; C( S& b, S && c ) : mc2{b}, mc3{std::move(c)} {} }; int main() { return 0; } /// END CODE /// I compile it with command: g++ test.cpp -std=3Dc++0x -o test.exe The output is: test.cpp: In constructor =E2=80=98C::C(S&, S&&)=E2=80=99: test.cpp:9:48: error: invalid initialization of non-const reference of type =E2=80=98S&=E2=80=99 from an rvalue of type =E2=80=98=E2=80=99 test.cpp:9:48: error: invalid initialization of reference of type =E2=80=98= S&&=E2=80=99 from expression of type =E2=80=98=E2=80=99 Compiler version (g++ -v): Using built-in specs. COLLECT_GCC=3Dg++ COLLECT_LTO_WRAPPER=3D/usr/libexec/gcc/i686-redhat-linux/4.6.0/lto-wrapper Target: i686-redhat-linux Configured with: ../configure --prefix=3D/usr --mandir=3D/usr/share/man --infodir=3D/usr/share/info --with-bugurl=3Dhttp://bugzilla.redhat.com/bugz= illa --enable-bootstrap --enable-shared --enable-threads=3Dposix --enable-checking=3Drelease --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=3Dc,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-pl= ugin --enable-java-awt=3Dgtk --disable-dssi --with-java-home=3D/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=3D/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=3Dgeneric --with-arch=3Di686 --build=3Di686-redhat-linux Thread model: posix gcc version 4.6.0 20110428 (Red Hat 4.6.0-6) (GCC)