public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97572] New: [c++ 20] Constraining is broken
@ 2020-10-25 19:21 dimitri.gorokhovik at free dot fr
  2020-10-25 22:06 ` [Bug c++/97572] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dimitri.gorokhovik at free dot fr @ 2020-10-25 19:21 UTC (permalink / raw)
  To: gcc-bugs

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)

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

end of thread, other threads:[~2021-04-27 10:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-25 19:21 [Bug c++/97572] New: [c++ 20] Constraining is broken dimitri.gorokhovik at free dot fr
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

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).