enum Specifier {
VS_None = 0,
VS_Override = 1,
- VS_Final = 2,
- VS_New = 4
+ VS_Final = 2
};
VirtSpecifiers() : Specifiers(0) { }
bool isFinalSpecified() const { return Specifiers & VS_Final; }
SourceLocation getFinalLoc() const { return VS_finalLoc; }
- bool isNewSpecified() const { return Specifiers & VS_New; }
- SourceLocation getNewLoc() const { return VS_newLoc; }
-
void clear() { Specifiers = 0; }
static const char *getSpecifierName(Specifier VS);
private:
unsigned Specifiers;
- SourceLocation VS_overrideLoc, VS_finalLoc, VS_newLoc;
+ SourceLocation VS_overrideLoc, VS_finalLoc;
SourceLocation LastLocation;
};
Diag(VS.getOverrideLoc(), diag::ext_override_inline) << "override";
if (VS.isFinalSpecified())
Diag(VS.getFinalLoc(), diag::ext_override_inline) << "final";
- if (VS.isNewSpecified())
- Diag(VS.getNewLoc(), diag::ext_override_inline) << "new";
FnD = Actions.ActOnCXXMemberDeclarator(getCurScope(), AS, D,
move(TemplateParams), 0,
/// virt-specifier:
/// override
/// final
-/// new
VirtSpecifiers::Specifier Parser::isCXX0XVirtSpecifier() const {
if (!getLang().CPlusPlus)
return VirtSpecifiers::VS_None;
- if (Tok.is(tok::kw_new))
- return VirtSpecifiers::VS_New;
-
if (Tok.is(tok::identifier)) {
IdentifierInfo *II = Tok.getIdentifierInfo();
default: assert(0 && "Unknown specifier!");
case VS_Override: VS_overrideLoc = Loc; break;
case VS_Final: VS_finalLoc = Loc; break;
- case VS_New: VS_newLoc = Loc; break;
}
return false;
default: assert(0 && "Unknown specifier");
case VS_Override: return "override";
case VS_Final: return "final";
- case VS_New: return "new";
}
}
struct B : Base1 {
virtual void f() override {} // expected-warning {{'override' keyword only allowed in declarations, allowed as an extension}}
virtual void g() final {} // expected-warning {{'final' keyword only allowed in declarations, allowed as an extension}}
- virtual void h() new {} // expected-warning {{'new' keyword only allowed in declarations, allowed as an extension}}
};
}
};
struct A : Base1 {
- virtual void f() new new; // expected-error {{class member already marked 'new'}}
virtual void g() override override; // expected-error {{class member already marked 'override'}}
virtual void h() final final; // expected-error {{class member already marked 'final'}}
};
};
struct A : Base1 {
- virtual void f() new new {} // expected-error {{class member already marked 'new'}}
virtual void g() override override {} // expected-error {{class member already marked 'override'}}
virtual void h() final final {} // expected-error {{class member already marked 'final'}}
};
struct S : Base {
virtual void final() final;
virtual void override() override;
- virtual void n() new;
- int i : 3 new;
- int j new;
};
struct T {