struct A {
constexpr virtual void call(int) = 0;
constexpr void call2() { call(0); }
};
struct B : A {
constexpr void call(int) override {}
};
consteval void check() {
B b;
b.call2();
}
int main() { check(); }
<source>:16:14: error: call to consteval function 'check' is not a constant expression
16 | int main() { check(); }
| ^
<source>:4:30: note: pure virtual function 'A::call' called
4 | constexpr void call2() { call(0); }
| ^
<source>:13:5: note: in call to 'b.call2()'
13 | b.call2();
| ^~~~~~~~~
<source>:16:14: note: in call to 'check()'
16 | int main() { check(); }
| ^~~~~~~
<source>:2:28: note: declared here
2 | constexpr virtual void call(int) = 0;
| ^
1 error generated.
Compiler returned: 1
https://godbolt.org/z/h4hdW9ars