c++ - Can virtual functions be constexpr? -
can virtual functions x::f() in following code
struct x { constexpr virtual int f() const { return 0; } }; be constexpr?
no. [dcl.constexpr]/3 (7.1.5, "the constexpr specifier"):
the definition of
constexprfunction shall satisfy following requirements:— shall not virtual
Comments
Post a Comment