Question about c++x0 explicit virtual functions


I'm trying to use the new explicit/override/new/final keywords, but I have trouble with some constructs.
As I don't managed to find the part of the specification that describe theses new keywords, I hope someone here can help me.

If I declare the classes A and B as follow, everything is fine. clang compiles and properly checks that foo() is declared in the super class (A).

class A { virtual void foo(); };
class B : public A { virtual void foo() override; };

Now, if I want to define B::foo() in my class definition like this:

class B : public A { virtual void foo() override {} };

clang refuses to compile by telling me it expects a semi at end of declaration list (and point to the space just behind override).

Is there something I miss in these new keyword usages, or is it a clang error, or is this construct prohibited by the C++ current standard ?


-- Jean-Daniel

Hi Jean-Daniel,

the keywords currently don’t work in on inline member functions.

While this is correct according to the C++0x spec, please file a bug so we can support it anyway. Maybe we could get the spec fixed as well.

  • Anders

Thank you for the answer.

Bug filled at