public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/25811] No failure creating a POD containing a const member, using new without a new-initializer.
Date: Tue, 30 Mar 2010 11:19:00 -0000 [thread overview]
Message-ID: <20100330111918.9535.qmail@sourceware.org> (raw)
In-Reply-To: <bug-25811-12027@http.gcc.gnu.org/bugzilla/>
------- Comment #6 from redi at gcc dot gnu dot org 2010-03-30 11:19 -------
(In reply to comment #5)
> > Nevertheless, can you confirm that it is valid C++03 ?
>
> I mean invalid, sorry.
Yup :-)
It is invalid. A is a non-POD class type, so 5.3.4/15 says the new-expression
without a new-initializer causes the object to be default-initialized, which
causes a default constructor to be implicitly-defined with an empty
mem-initializer list (12.1/7) which is ill-formed by 8.5/5 because the
reference member is not initialized.
In C++03 the cases of Foo and A are slightly different, "new Foo" is ill-formed
according to 5.3.4/15 and "new A" is ill-formed as described above.
In C++0x both "new Foo" and "new A" result in a call to a deleted constructor.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25811
next prev parent reply other threads:[~2010-03-30 11:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-16 20:00 [Bug c++/25811] New: " fabien dot chene at laposte dot net
2006-01-16 20:06 ` [Bug c++/25811] " pinskia at gcc dot gnu dot org
2010-03-30 8:22 ` fabien dot chene at gmail dot com
2010-03-30 9:16 ` redi at gcc dot gnu dot org
2010-03-30 10:07 ` fabien dot chene at gmail dot com
2010-03-30 10:10 ` fabien dot chene at gmail dot com
2010-03-30 11:19 ` redi at gcc dot gnu dot org [this message]
2010-03-31 7:07 ` fabien dot chene at gmail dot com
2010-03-31 8:55 ` redi at gcc dot gnu dot org
2010-03-31 12:21 ` fabien dot chene at gmail dot com
2010-03-31 12:34 ` redi at gcc dot gnu dot org
2010-03-31 13:46 ` fabien dot chene at gmail dot com
2010-03-31 13:53 ` redi at gcc dot gnu dot org
2010-04-12 19:58 ` jason at gcc dot gnu dot org
[not found] <bug-25811-4@http.gcc.gnu.org/bugzilla/>
2012-05-24 22:46 ` 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=20100330111918.9535.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).