Can virtual functions be constexpr?
Can virtual functions like X::f() in the following code struct X { constexpr virtual int f() const { return 0; } }; be constexpr ? Kerrek SB This answer is no longer correct as of C++20. No. From [dcl.constexpr]/3 (7.1.5, "The constexpr specifier"): The definition of a constexpr function shall satisfy the following requirements: — it shall not be virtual Up through C++17, virtual functions could not be declared constexpr . The general reason being that, in constexpr code, everything happen can at compile time. So there really isn't much point to having a function which takes a reference to a