Код: Выделить всё
#include
struct Base {
virtual void f() {}
};
template
struct Derived : Base {
void f() requires std::is_same_v override {}
};
Код: Выделить всё
11.7.3 Virtual functions
6 A virtual function shall not have a trailing requires-clause ([dcl.decl]).
[Example 5:
template
struct A {
virtual void f() requires true; // error: virtual function cannot be constrained ([temp.constr.decl])
};
— end example]
Подробнее здесь: https://stackoverflow.com/questions/798 ... -overrides
Мобильная версия