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

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
For completeness:

template<typename T> concept C = true;

struct S
{
  template <typename T> requires C<T>
  [[nodiscard]] friend constexpr bool bar (const S &, const T &) { return true;
}
};

void
foo ()
{
  S s;
  bar (s, 0);
}

$ g++ -std=c++20 -c f.cc -fconcepts-ts
f.cc:6:3: error: two consecutive '[' shall only introduce an attribute before
'[' token
    6 |   [[nodiscard]] friend constexpr bool bar (const S &, const T &) {
return true; }
      |   ^
f.cc: In function 'void foo()':
f.cc:13:7: error: no matching function for call to 'bar(S&, int)'
   13 |   bar (s, 0);
      |   ~~~~^~~~~~
f.cc:6:39: note: candidate: 'template<class T>  requires 
<erroneous-expression> constexpr bool bar(const S&, const T&)'
    6 |   [[nodiscard]] friend constexpr bool bar (const S &, const T &) {
return true; }
      |                                       ^~~
f.cc:6:39: note:   template argument deduction/substitution failed:
f.cc:6:39: note: constraints not satisfied

Reply via email to