public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type
@ 2011-08-08 20:56 akrzemi1 at gmail dot com
  2011-08-08 22:29 ` [Bug c++/50025] " redi at gcc dot gnu.org
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: akrzemi1 at gmail dot com @ 2011-08-08 20:56 UTC (permalink / raw)
  To: gcc-bugs

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

           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 <utility>

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=c++0x -o test.exe

The output is:
test.cpp: In constructor ‘C::C(S&, S&&)’:
test.cpp:9:48: error: invalid initialization of non-const reference of type
‘S&’ from an rvalue of type ‘<brace-enclosed initializer list>’
test.cpp:9:48: error: invalid initialization of reference of type ‘S&&’ from
expression of type ‘<brace-enclosed initializer list>’

Compiler version (g++ -v):
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-redhat-linux/4.6.0/lto-wrapper
Target: i686-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin
--enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --with-tune=generic --with-arch=i686
--build=i686-redhat-linux
Thread model: posix
gcc version 4.6.0 20110428 (Red Hat 4.6.0-6) (GCC)


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2015-03-19 10:38 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-08 20:56 [Bug c++/50025] New: C++0x initialization syntax doesn't work for class members of reference type akrzemi1 at gmail dot com
2011-08-08 22:29 ` [Bug c++/50025] " redi at gcc dot gnu.org
2011-08-08 22:47 ` redi at gcc dot gnu.org
2011-08-08 23:31 ` akrzemi1 at gmail dot com
2011-08-16 16:44 ` redi at gcc dot gnu.org
2011-10-26 10:34 ` paolo.carlini at oracle dot com
2011-10-26 10:45 ` daniel.kruegler at googlemail dot com
2011-10-26 10:59 ` [Bug c++/50025] [DR 1288] " redi at gcc dot gnu.org
2012-04-14  7:07 ` marc.glisse at normalesup dot org
2012-04-14 11:02 ` redi at gcc dot gnu.org
2012-09-13 12:45 ` temp78593 at mutluit dot com
2012-09-30 10:58 ` redi at gcc dot gnu.org
2013-01-18 15:35 ` redi at gcc dot gnu.org
2013-01-19 20:42 ` redi at gcc dot gnu.org
2013-11-03 12:22 ` paolo.carlini at oracle dot com
2014-03-01 11:22 ` ville.voutilainen at gmail dot com
2014-03-01 16:52 ` 3dw4rd at verizon dot net
2014-03-01 16:54 ` 3dw4rd at verizon dot net
2014-03-01 17:01 ` glisse at gcc dot gnu.org
2014-03-01 21:00 ` emsr at gcc dot gnu.org
2014-03-01 21:11 ` jason at gcc dot gnu.org
2014-03-01 22:52 ` emsr at gcc dot gnu.org
2014-03-01 22:57 ` emsr at gcc dot gnu.org
2014-03-19 13:23 ` redi at gcc dot gnu.org
2014-03-25 10:58 ` d.v.a at ngs dot ru
2015-03-19 10:58 ` paolo.carlini at oracle dot com

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).