https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101828
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-08-09 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- With -pedantic-errors -std=c++17, we do reject it: <source>:2:19: error: member 'fun' can be declared both 'virtual' and 'constexpr' only in '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions] 2 | constexpr int virtual fun() const{ | ~~~~~~~~~ ^~~~~~~ With -pedantic-errors -std=c++20 we don't reject this even though we should, clang gives: Output of x86-64 clang (trunk) (Compiler #2) <source>:8:15: error: constexpr variable 'v' must be initialized by a constant expression constexpr int v = rf.fun(); ^ ~~~~~~~~ <source>:8:22: note: virtual function called on object 'obj' whose dynamic type is not constant constexpr int v = rf.fun(); ^