From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CDE973858D33; Wed, 18 Oct 2023 09:44:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CDE973858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697622255; bh=pCYWPiy3f5W+/fQLA/jwzYxNnUxK6fqBWq/a9vzZi+g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dIkYsLPhCV5gtwL5O5Kux+Y1q/nckoArReMLKz2tHc5MWTFui/d1rHI0GNXo7NA2q fC5Sexhk+QZr6YLf32e+bUbfZK4BSjOOd5YiAeewpTLgr9+Zfplv5TpnTALB6zhRpE EthSuJO0ROESTu4YDb2M0Wb0a4EuJVA2qZkIw1BQ= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/111854] new (align_val_t) should be ill-formed Date: Wed, 18 Oct 2023 09:44:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: SUSPENDED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111854 --- Comment #9 from Jonathan Wakely --- (In reply to Andrew Pinski from comment #6) > You are mixing up 2 different things. > First this is about if the operator new is valid and it is because there = is > a corresponding placement delete operator (this would be rejected at comp= ile > time). The point is that [expr.new] p28 says it's ill-formed. Yes, there's a corresponding delete operator, but it's one of the "usual deallocation functions", and that isn't an allowed lookup result for a placement new expression. This might seem surprising, but it's what the standard says. > Second is if you can call the normal delete on an allocated memory from t= hat > inplacement new call. The answer is yes you can and not invoke undefined > behavior. That's not what the standard says. 'delete p' will call either operator delete(void*) or operator delete(void*, size_t), and those functions have a precondition that the pointer was obtai= ned from an allocation function without an alignment parameter. See [new.delete.single] p11.=