From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6ACE13833017; Wed, 11 Nov 2020 20:05:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6ACE13833017 From: "glenjofe at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/96416] address_of() is broken by static_assert in pointer_traits Date: Wed, 11 Nov 2020 20:05:55 +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: X-Bugzilla-Severity: normal X-Bugzilla-Who: glenjofe at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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: Wed, 11 Nov 2020 20:05:55 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96416 Glen Joseph Fernandes changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |glenjofe at gmail dot com --- Comment #6 from Glen Joseph Fernandes --- > Do we then have a spec bug? The to_address(const P&) overload always assumed a valid pointer_traits

. Even before it was std::to_address in C++20, when it was __to_address in libstdc++, or boost::to_address, or __to_raw_pointer in libc++, and was use= d in C++11 and above, its return type was 'typename std::pointer_traits

::element_type*' which requires a valid pointer_trait= s. i.e. Our allocator-aware containers would only ever work with fancy pointer= P for which pointer_traits

is valid. std::to_address being used for more than just raw-or-fancy-pointers came la= ter (since Casey's P1474 which chose to use it for contiguous iterators). My gu= ess is they didn't realize pointer_traits wouldn't be valid for those iterat= or types.=