From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 70D0F385841C; Fri, 4 Nov 2022 14:26:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 70D0F385841C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667571988; bh=qSriuzfULqVosMKmmPAOFYacAtNdMovZiPdG5EniuoE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=v0G6W5ge2e23sI+ogEmbYYJGb+KyYeAwFFK19/wd4rt494NGu67kQGRuJri2Zf0dN a86PFoXF7unwF4Lbb8NnKvSDtyrfVquqYhbApzF8NpGywLGwpPOJGzXzj+3BJ/CJHS HSZTIQ3T1KjTVTdyRqtV95C43FXYWPtw4H5DqQ08= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/107525] propagate_const should not be using SFINAE on its conversion operators Date: Fri, 04 Nov 2022 14:26:28 +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: 12.2.1 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org 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: --- 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=3D107525 --- Comment #3 from Jonathan Wakely --- And the spec seems wrong as well. The const overload should be constrained = for const T being convertible to const element_type*. This should probably not compile: #include struct X { int& operator*() { return *i; } const int& operator*() const { return *i; } int* get() { return i; } const int* get() const { return i; } int* i =3D nullptr; operator int*() { return i; } operator const int*() const =3D delete; }; int main() { using std::experimental::propagate_const; X x; const propagate_const px(x); static_assert(!std::is_convertible_v); static_assert(std::is_convertible_v, const int*>= ); const int* pi =3D px; }=