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

            Bug ID: 103865
           Summary: virtual function can have a requires clause
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

A virtual function cannot have a requires clause, but GCC allows it to have:
```
struct A {
    virtual void foo() {}
};

template<class T>
struct B : A {
    void foo() requires true {}
};

int main() {
    B<void> b;
}

```
Both Clang and MSVC refuse to accept it. Demo:
https://gcc.godbolt.org/z/fEj6Wq53E

Reply via email to