public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jason at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-97841-4@http.gcc.gnu.org/bugzilla/> (raw)

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?

             reply	other threads:[~2020-11-15 17:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-15 17:01 jason at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-97841-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).