public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/97841] New: [C++17] is_invocable handling of incomplete return type is wrong
@ 2020-11-15 17:01 jason at gcc dot gnu.org
  2020-11-19 15:18 ` [Bug libstdc++/97841] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2020-11-15 17:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97841

            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<Fn>(),declval<ArgTypes>()...) 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 context
is ill-formed.  So we accept this testcase, but VC++ and clang/libc++ reject
it:

#include <type_traits>
struct A;
using fn = A(*)(int);
static_assert (std::is_invocable_v<fn,int>); // error, A is incomplete

Various other places in the library talk about an expression being "well-formed
when treated as an unevaluated operand" and could probably use a check to make
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?

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-06-23 12:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-15 17:01 [Bug libstdc++/97841] New: [C++17] is_invocable handling of incomplete return type is wrong jason at gcc dot gnu.org
2020-11-19 15:18 ` [Bug libstdc++/97841] " redi at gcc dot gnu.org
2021-04-19 10:40 ` redi at gcc dot gnu.org
2021-04-27 11:39 ` jakub at gcc dot gnu.org
2021-07-28  7:05 ` rguenth at gcc dot gnu.org
2022-04-11 12:29 ` redi at gcc dot gnu.org
2023-05-29 10:03 ` jakub at gcc dot gnu.org
2023-06-23 12:58 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).