From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8D4743851C09; Tue, 28 Apr 2020 21:39:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D4743851C09 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588109990; bh=tLwPEeVoboEPrcOi18371jgoRWr4UFBfQfhB4SjXlOo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=g6zqHeQhidapbZZDWc4Nvq3mRBhPnzYr7ID2NHWvFulss+Kx2U8/xCHl+lAUpwybb 5JGXzLisEYVHZTo2aoQTzIyxWZFn5xcuBPMrJA/yRsbaXTxDPo3fRjIpHqxcFvq7HS c1jtMavTZDBCZ21WWon4RVSoxstLK98T9/EEA6rM= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/94831] [10 Regression] vector no longer compiles Date: Tue, 28 Apr 2020 21:39:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.0 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 21:39:50 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94831 --- Comment #2 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #0) > In r277342 I changed std::_Construct for P0784R7, "More constexpr > containers" and the non-void return type means this no longer compiles: >=20 > #include > std::vector v(1); >=20 > This was never valid in C++98, and in C++11 to C++17 it's undefined (beca= use > the pseudo-destructor call in allocator_traits>::destroy > is ill-formed for arrays). But for libstdc++ it happened to compile, beca= use > we elide the calls to trivial destructors. We should consider making this change in stage 1, to stop silently accepting that non-standard code in strict mode: --- a/libstdc++-v3/include/bits/alloc_traits.h +++ b/libstdc++-v3/include/bits/alloc_traits.h @@ -734,6 +734,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Destroy(_ForwardIterator __first, _ForwardIterator __last, allocator<_Tp>&) { +#if __cplusplus >=3D 201103L && defined __STRICT_ANSI__ + static_assert(!is_array<_Tp>::value, + "arrays are not Erasable from containers using std::allocator"); +#endif _Destroy(__first, __last); }=