This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/25811] No failure creating a POD containing a const member, using new without a new-initializer.
- From: "redi at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Mar 2010 08:55:28 -0000
- Subject: [Bug c++/25811] No failure creating a POD containing a const member, using new without a new-initializer.
- References: <bug-25811-12027@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #8 from redi at gcc dot gnu dot org 2010-03-31 08:55 -------
(N.B. your email to gcc-patches gives the wrong PR number in the subject.)
This reject the following valid program:
struct X {
X() : c(0), r(c) {}
const int c;
int const& r;
};
int main()
{
new X;
}
If there is a default constructor it will be called, and so the members will
not be uninitialized.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25811