From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 883DB38618EE; Sun, 15 Nov 2020 17:01:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 883DB38618EE From: "jason at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/97841] New: [C++17] is_invocable handling of incomplete return type is wrong Date: Sun, 15 Nov 2020 17:01:51 +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: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jason at gcc dot gnu.org 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, 15 Nov 2020 17:01:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97841 Bug ID: 97841 Summary: [C++17] is_invocable handling of incomplete return type is wrong Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: jason at gcc dot gnu.org Target Milestone: --- I already mentioned this to Jonathan directly, but thought I should probably also put it in bugzilla. is_invocable and invoke_result condition their result on whether "The expression INVOKE(declval(),declval()...) is well-formed when treated as an unevaluated operand" It seems that we currently test for this by checking whether decltype of the above is well-formed, but that seems wrong to me, since decltype of a call = of incomplete type is well-formed, but that call in any other unevaluated cont= ext is ill-formed. So we accept this testcase, but VC++ and clang/libc++ reject it: #include struct A; using fn =3D A(*)(int); static_assert (std::is_invocable_v); // error, A is incomplete Various other places in the library talk about an expression being "well-fo= rmed when treated as an unevaluated operand" and could probably use a check to m= ake sure they don't have the same problem. I imagine that changing decltype(INVOKE(...)) to decltype(0,INVOKE(...)) in various places would be a simple fix?=