From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AB373398B425; Wed, 3 Mar 2021 23:57:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AB373398B425 From: "cjdb.ns at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99374] New: C++17/20 mode fails to recognise pointer-to-member functions of incomplete types in conditional expression Date: Wed, 03 Mar 2021 23:57:21 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cjdb.ns 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 attachments.created 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: Wed, 03 Mar 2021 23:57:21 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99374 Bug ID: 99374 Summary: C++17/20 mode fails to recognise pointer-to-member functions of incomplete types in conditional expression Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: cjdb.ns at gmail dot com Target Milestone: --- Created attachment 50296 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D50296&action=3Dedit Failure with -std=3Dc++17 GCC seems to be unable to handle pointer-to-member functions of incomplete types in conditional expressions. The following works on both Clang and MSV= C, and some invocations of GCC. ``` struct S; using F1 =3D int (S::*)(); using F2 =3D int (S::*)() noexcept; auto v =3D true ? F1() : F2(); auto w =3D true ? F2() : F1(); ``` This appears to work if `-std=3Dc++14`, but not `-std=3Dc++17` or `-std=3Dc= ++20` for GCC versions >=3D 7. GCC < 7 doesn't have a problem compiling even in C++17= mode. # Versions * All GCC releases from 7.1.0 through trunk. # System type * Ubuntu 18.04 (checked GCC 10.1) * Ubuntu 20.04 on WSL2 (checked GCC 10.2) * Debian (checked GCC 10.2.1) * Compiler Explorer (checked all other reported versions). # Options given to GCC `g++ -save-temps fail-17.cpp -c -std=3Dc++17` # Diagnostic ``` fail-17.cpp:5:27: error: could not convert =E2=80=98((int (S::*)() noexcept= )0)=E2=80=99 from =E2=80=98int (S::*)() noexcept=E2=80=99 to =E2=80=98int (S::*)()=E2=80=99 5 | auto v =3D true ? F1() : F2(); | ^ | | | int (S::*)() noexcept fail-17.cpp:6:27: error: could not convert =E2=80=98((int (S::*)() noexcept= )0)=E2=80=99 from =E2=80=98int (S::*)() noexcept=E2=80=99 to =E2=80=98int (S::*)()=E2=80=99 6 | auto w =3D true ? F2() : F1(); | ^ | | | int (S::*)() noexcept ```=