From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27180 invoked by alias); 5 Sep 2014 14:19:32 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 27158 invoked by uid 89); 5 Sep 2014 14:19:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 05 Sep 2014 14:19:26 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s85EJNO7026110 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 5 Sep 2014 10:19:23 -0400 Received: from [10.10.116.20] ([10.10.116.20]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s85EJMDc016249; Fri, 5 Sep 2014 10:19:22 -0400 Message-ID: <5409C666.4050607@redhat.com> Date: Fri, 05 Sep 2014 14:19:00 -0000 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 MIME-Version: 1.0 To: Jonathan Wakely , Andrew Haley CC: Andy Webber , gcc-help , Richard Biener Subject: Re: is portable aliasing possible in C++? References: <5408988E.2060301@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2014-09/txt/msg00043.txt.bz2 On 09/04/2014 07:11 PM, Jonathan Wakely wrote: > Placement new might work with GCC in practice as long as the buffer is > correctly aligned and the type being constructed does not have > non-trivial initialization. However, my reading of the standard is > that after the placement new, if the object's members are not > initialized then they have indeterminate values (not the values that > were at those memory addresses already, even though that's likely to > be what happens in practice). I think that's a defect in the (non-normative) note in 5.3.4/17, which is assuming that this follows from the rule in 8.5/12. But I don't think it does, because in this case the storage has been initialized and therefore is no longer indeterminate. So I think the placement new form is OK. Jason