зеркало из https://github.com/microsoft/clang-1.git
Diagnose ambiguity of operator delete and operator delete[]. Sebastian, please review.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88747 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
7d90199f10
Коммит
0ba63ea5be
|
@ -851,8 +851,13 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
|
|||
// Try to find operator delete/operator delete[] in class scope.
|
||||
LookupResult Found;
|
||||
LookupQualifiedName(Found, Record, DeleteName, LookupOrdinaryName);
|
||||
|
||||
if (Found.isAmbiguous()) {
|
||||
DiagnoseAmbiguousLookup(Found, DeleteName, StartLoc);
|
||||
return ExprError();
|
||||
}
|
||||
|
||||
// FIXME: Diagnose ambiguity properly
|
||||
assert(!Found.isAmbiguous() && "Ambiguous delete/delete[] not handled");
|
||||
for (LookupResult::iterator F = Found.begin(), FEnd = Found.end();
|
||||
F != FEnd; ++F) {
|
||||
if (CXXMethodDecl *Delete = dyn_cast<CXXMethodDecl>(*F))
|
||||
|
|
|
@ -165,3 +165,20 @@ template <class T> struct TBase {
|
|||
|
||||
TBase<int> t1; // expected-note {{in instantiation of template class 'struct TBase<int>' requested here}}
|
||||
|
||||
class X6 {
|
||||
public:
|
||||
static void operator delete(void*, int); // expected-note {{member found by ambiguous name lookup}}
|
||||
};
|
||||
|
||||
class X7 {
|
||||
public:
|
||||
static void operator delete(void*, int); // expected-note {{member found by ambiguous name lookup}}
|
||||
};
|
||||
|
||||
class X8 : public X6, public X7 {
|
||||
};
|
||||
|
||||
void f(X8* x8) {
|
||||
delete x8; // expected-error {{member 'operator delete' found in multiple base classes of different types}}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче