From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DB5B93858D35; Sun, 2 Aug 2020 04:17:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB5B93858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596341833; bh=cGHfWh6q+fEy10ZbKnIJtPdQkG2RBaXKYXfS3RXdqCA=; h=From:To:Subject:Date:From; b=CUjLW7F4c2PVBY30lkrQMH8K65J7xsFfiu/v9zDwqPEkJAH82r3EknzmVPSBcxQwz zzPyGTXBYdnhGzJNyfpwhpNAqP0M2geQQ7i18UqT9S+rATOxNnHEQJwillgdhHvsoT oOaSNPbjlPj11oyxwq/SaLwPok1grm/U7t1lJ/4Q= From: "whatwasthataddress at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/96416] New: address_of() is broken by static_assert in pointer_traits Date: Sun, 02 Aug 2020 04:17:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: whatwasthataddress at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Sun, 02 Aug 2020 04:17:14 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96416 Bug ID: 96416 Summary: address_of() is broken by static_assert in pointer_traits Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: whatwasthataddress at gmail dot com Target Milestone: --- pointer_traits contains this static_assert: static_assert(!is_same::value, "pointer type defines element_type or is like SomePointer"); When trying to use address_of() with an iterator that has a usable operator->(), address_of() fails because the static_assert causes a hard er= ror in the trailing decltype here: template constexpr auto __to_address(const _Ptr& __ptr) noexcept -> decltype(std::pointer_traits<_Ptr>::to_address(__ptr)) { return std::pointer_traits<_Ptr>::to_address(__ptr); } template constexpr auto __to_address(const _Ptr& __ptr, _None...) noexcept { if constexpr (is_base_of_v<__gnu_debug::_Safe_iterator_base, _Ptr>) return std::__to_address(__ptr.base().operator->()); else return std::__to_address(__ptr.operator->()); } When I comment out the static_assert, to_address() works with the iterator = in question.=