public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dimitri.gorokhovik at free dot fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/97572] New: [c++ 20] Constraining is broken
Date: Sun, 25 Oct 2020 19:21:49 +0000	[thread overview]
Message-ID: <bug-97572-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 97572
           Summary: [c++ 20] Constraining is broken
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dimitri.gorokhovik at free dot fr
  Target Milestone: ---

The code:

constexpr bool any (bool) { return true; };
template <typename T> concept Any = requires (T t) { requires any (t); };
constexpr static int f (Any auto) { return 42; };
constexpr auto q = f (false);


when compiled as:

g++ -std=c++20  -o bug-9.o -c  bug-9.cpp


produces:

bug-9.cpp: In substitution of ‘template<class auto:1>  requires  Any<auto:1>
constexpr int f(auto:1) [with auto:1 = bool]’:
bug-9.cpp:5:28:   required from here
bug-9.cpp:3:63: error: ‘t’ is not a constant expression
    3 | template <typename T> concept Any = requires (T t) { requires any (t);
};
      |                                                      ~~~~~~~~~^~~~~~~
bug-9.cpp:5:28: error: no matching function for call to ‘f(bool)’
    5 | constexpr auto q = f (false);
      |                            ^
bug-9.cpp:4:22: note: candidate: ‘template<class auto:1>  requires  Any<auto:1>
constexpr int f(auto:1)’
    4 | constexpr static int f (Any auto) { return 42; };
      |                      ^
bug-9.cpp:4:22: note:   substitution of deduced template arguments resulted in
errors seen above


GCC version:

g++ (GCC) 11.0.0 20201025 (experimental)

             reply	other threads:[~2020-10-25 19:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-25 19:21 dimitri.gorokhovik at free dot fr [this message]
2020-10-25 22:06 ` [Bug c++/97572] " redi at gcc dot gnu.org
2020-10-26 10:45 ` dimitri.gorokhovik at free dot fr
2020-10-26 11:37 ` redi at gcc dot gnu.org
2020-10-26 12:22 ` dimitri.gorokhovik at free dot fr
2021-04-27 10:22 ` redi at gcc dot gnu.org
2021-04-27 10:27 ` 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-97572-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).