public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112448] New: Constraint expression b<x.v> rejected
@ 2023-11-08 20:49 fchelnokov at gmail dot com
  2023-11-08 21:48 ` [Bug c++/112448] " pinskia at gcc dot gnu.org
  2023-11-08 21:54 ` ppalka at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: fchelnokov at gmail dot com @ 2023-11-08 20:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112448
           Summary: Constraint expression b<x.v> rejected
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

This program

struct s { static constexpr bool v = true; };
template<auto> inline constexpr bool b = true;
constexpr bool f(auto x) requires b<x.v> { return true; }
static_assert(f(s{})); // clang ok, gcc nope, msvc ok

is valid per the explanation here https://stackoverflow.com/a/77439003/7325599


but GCC rejects it with the error:

missing template arguments before '<' token
    3 | constexpr bool f(auto x) requires b<x.v> { return true; }
      |                                    ^
<source>:3:36: error: expected initializer before '<' token
<source>:4:15: error: 'f' was not declared in this scope
    4 | static_assert(f(s{}));

Online demo: https://godbolt.org/z/1Gejvr4cn

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

* [Bug c++/112448] Constraint expression b<x.v> rejected
  2023-11-08 20:49 [Bug c++/112448] New: Constraint expression b<x.v> rejected fchelnokov at gmail dot com
@ 2023-11-08 21:48 ` pinskia at gcc dot gnu.org
  2023-11-08 21:54 ` ppalka at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-08 21:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note the error message on the trunk changed to:
<source>:4:40: error: template argument 1 is invalid
    4 | constexpr bool f(auto x) requires b<x.v> { return true; }
      |                                        ^

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

* [Bug c++/112448] Constraint expression b<x.v> rejected
  2023-11-08 20:49 [Bug c++/112448] New: Constraint expression b<x.v> rejected fchelnokov at gmail dot com
  2023-11-08 21:48 ` [Bug c++/112448] " pinskia at gcc dot gnu.org
@ 2023-11-08 21:54 ` ppalka at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-11-08 21:54 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
dup

*** This bug has been marked as a duplicate of bug 104255 ***

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

end of thread, other threads:[~2023-11-08 21:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-08 20:49 [Bug c++/112448] New: Constraint expression b<x.v> rejected fchelnokov at gmail dot com
2023-11-08 21:48 ` [Bug c++/112448] " pinskia at gcc dot gnu.org
2023-11-08 21:54 ` ppalka 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).