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 constexpr function shall satisfy following requirements:

— shall not virtual


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -