From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25118 invoked by alias); 30 Mar 2010 09:16:53 -0000 Received: (qmail 25072 invoked by uid 48); 30 Mar 2010 09:16:40 -0000 Date: Tue, 30 Mar 2010 09:16:00 -0000 Message-ID: <20100330091640.25071.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/25811] No failure creating a POD containing a const member, using new without a new-initializer. In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "redi at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-03/txt/msg02994.txt.bz2 ------- Comment #3 from redi at gcc dot gnu dot org 2010-03-30 09:16 ------- (In reply to comment #2) > is it still invalid in c++0X ? Yes. > 5.3.4.15 has been revamped, and I no longer find a motif to reject such code. In C++0x the object is default-initialized, which for a class type means the default constructor is called. In this code, the default constructor is deleted, so the code will not compile. See 12.1/5 > I think the following code is also invalid, according to 8.5.6 (c++03) / 8.5.8 > (c++0x): > > struct A { int& i; }; > void f () { new A; } Not quite: in C++0x the program doesn't call for default-initialization of A::i, it calls for default-initialization of A, which is invalid because the default constructor is deleted. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25811