Before we skipped that for virtual functions not fully qualified (r81507).
This commit basically reverts this to the older behaviour, which seems
more consistent. We now also correctly consider ill-formed calls to deleted
member functions, which were silently passed before in some cases.
The review contains the whole discussion.
PR: 20268
Differential Revision: http://reviews.llvm.org/D11334
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242857
91177308-0d34-0410-b5e6-
96231b3b80d8
BaseExpr = new (Context) CXXThisExpr(Loc, BaseExprType,/*isImplicit=*/true);
}
- bool ShouldCheckUse = true;
- if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(MemberDecl)) {
- // Don't diagnose the use of a virtual member function unless it's
- // explicitly qualified.
- if (MD->isVirtual() && !SS.isSet())
- ShouldCheckUse = false;
- }
-
// Check the use of this member.
- if (ShouldCheckUse && DiagnoseUseOfDecl(MemberDecl, MemberLoc))
+ if (DiagnoseUseOfDecl(MemberDecl, MemberLoc))
return ExprError();
if (FieldDecl *FD = dyn_cast<FieldDecl>(MemberDecl))
}
struct B {
- virtual void f() __attribute__((deprecated)); // expected-note 4 {{'f' has been explicitly marked deprecated here}}
+ virtual void f() __attribute__((deprecated)); // expected-note 6 {{'f' has been explicitly marked deprecated here}}
void g();
};
void B::g() {
- f();
+ f(); // expected-warning{{'f' is deprecated}}
B::f(); // expected-warning{{'f' is deprecated}}
}
}
void f(B* b, C *c) {
- b->f();
+ b->f(); // expected-warning{{'f' is deprecated}}
b->B::f(); // expected-warning{{'f' is deprecated}}
c->f();
virtual void f() __attribute__((deprecated));
};
-void D::f() { }
+void D::f() { } // expected-note{{'f' has been explicitly marked deprecated here}}
void f(D* d) {
- d->f();
+ d->f(); // expected-warning{{'f' is deprecated}}
}
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
+
+struct S {
+ virtual void f() = delete; //expected-note{{'f' has been explicitly marked deleted here}}
+ void g() { f(); } //expected-error{{attempt to use a deleted function}}
+};