public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "schaub-johannes at web dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/43453] Initialization of char array with string literal fails in mem-initializer
Date: Sat, 28 Aug 2010 14:40:00 -0000	[thread overview]
Message-ID: <20100828143958.706.qmail@sourceware.org> (raw)
In-Reply-To: <bug-43453-16474@http.gcc.gnu.org/bugzilla/>



------- Comment #2 from schaub-johannes at web dot de  2010-08-28 14:39 -------
(In reply to comment #1)
> (In reply to comment #0)
> > Fails to compile, but should work:
> > 
> > struct A { 
> >   char x[4]; 
> >   A():x("bug") { } 
> > };
> > 
> > Error i get is:
> > 
> > "main.cpp:3: error: array used as initializer"
> > 
> 
> Why do you think it should work?  
> For example, the following equivalent code is invalid as well:
> 
> char x [4] ("bug");
> 

This code is equivalent and is valid. At least, I don't see the Standard
forbidding it. GCC is the only compiler I tested (comeau/edg, clang) that
rejects it.


-- 


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


  parent reply	other threads:[~2010-08-28 14:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-20  3:06 [Bug c++/43453] New: " schaub-johannes at web dot de
2010-08-27 18:06 ` [Bug c++/43453] " giecrilj at stegny dot 2a dot pl
2010-08-28 14:40 ` schaub-johannes at web dot de [this message]
     [not found] <bug-43453-4@http.gcc.gnu.org/bugzilla/>
2010-10-30  9:41 ` schaub-johannes at web dot de
2011-05-14 17:28 ` schaub.johannes at googlemail dot com
2012-01-28  5:55 ` pinskia at gcc dot gnu.org
2014-05-26 10:37 ` paolo.carlini at oracle dot com
2014-06-04 22:31 ` paolo at gcc dot gnu.org
2014-06-04 22:32 ` paolo.carlini at oracle dot com
2014-06-05 20:56 ` jason at gcc dot gnu.org

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=20100828143958.706.qmail@sourceware.org \
    --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).