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

Reply via email to