public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/49669] [4.6/4.7 Regression] [C++0x] Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530"
Date: Thu, 07 Jul 2011 16:40:00 -0000	[thread overview]
Message-ID: <bug-49669-4-NM0l1R3LEJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-49669-4@http.gcc.gnu.org/bugzilla/>

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-07-07 16:39:56 UTC ---
(In reply to comment #4)
> Say, since you're here, if I change the definition of x from "Foo[2]" to
> "std::array<Foo,2>", should I be allowed to initialize it with
> 
>    Goo::Goo() : x{{Foo(4), Foo(5)}} { }

I think that should be valid

> At the moment, _only_ the following seems to work:
> 
>    Goo::Goo() : x({{Foo(4), Foo(5)}}) { }

Hmm, that creates a temporary array<Foo,2> and uses that to initialize x, I
don't think that should be necessary.

> In particular, initialization of "Foo[2]" and "std::array<Foo,2>" is anything
> but "uniform" :-)

It will never be completely uniform, because one is an array and one is an
aggregate containing an array, but I think any of these should be valid:

struct Foo { explicit Foo(int) { } };

struct TwoFoo { Foo elems[2]; };

TwoFoo x{ Foo(1), Foo(1) };
TwoFoo y{ { Foo(1), Foo(1) } };
TwoFoo z( { Foo(1), Foo(1) } );    // ?

struct Goo
{
    Foo a[2];
    TwoFoo x, y, z;

    Goo()
        : a{ Foo(1), Foo(2) }
        , x{ Foo(1), Foo(2) }
        , y{ { Foo(1), Foo(2) } }
        , z( { Foo(1), Foo(2) } )  // ?
    { }
};

Jason, when you get around to looking at this ICE, could you comment on the
initialization question above?  Thanks!


  parent reply	other threads:[~2011-07-07 16:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-07 11:19 [Bug c++/49669] New: " z0sh at sogetthis dot com
2011-07-07 11:27 ` [Bug c++/49669] [4.6/4.7 Regression] [C++0x] " redi at gcc dot gnu.org
2011-07-07 11:50 ` z0sh at sogetthis dot com
2011-07-07 12:13 ` redi at gcc dot gnu.org
2011-07-07 13:19 ` rguenth at gcc dot gnu.org
2011-07-07 16:10 ` z0sh at sogetthis dot com
2011-07-07 16:40 ` redi at gcc dot gnu.org [this message]
2011-08-01 14:55 ` rguenth at gcc dot gnu.org
2011-08-05 21:22 ` jason at gcc dot gnu.org
2011-08-06  4:37 ` jason at gcc dot gnu.org
2011-08-06  4:39 ` jason at gcc dot gnu.org
2011-08-06  8:54 ` paolo.carlini at oracle dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-49669-4-NM0l1R3LEJ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).