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

            Bug ID: 116798
           Summary: requires expression can have an explicit object
                    parameter
           Product: gcc
           Version: 14.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
```
template<typename T>
concept C = requires(this T u, this T v) {
    u + v;
};

static_assert(C<int>);
```
is accepted by GCC, but I believe it shall not, because explicit object
parameters (this) do not make any sense in requires expression. And even in
class functions, explicit object parameter can only appear as the first
parameter of the parameter list.

Clang rejects this program. Online demo: https://gcc.godbolt.org/z/G8xq7rd4x

Reply via email to