[cfe-dev] Question about c++x0 explicit virtual functions

Jean-Daniel Dupas devlists at shadowlab.org
Mon Jan 24 09:51:43 PST 2011


Hello,

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 ? 

Thanks

-- Jean-Daniel








More information about the cfe-dev mailing list