forked from OSchip/llvm-project
Check that this cannot be used in a default argument. Happily, it was already implemented
llvm-svn: 58649
This commit is contained in:
parent
0cbd963817
commit
fa7431a807
|
@ -84,8 +84,13 @@ namespace {
|
|||
VDecl->getName(), DefaultArg->getSourceRange());
|
||||
}
|
||||
|
||||
// FIXME: when Clang has support for member functions, "this"
|
||||
// will also need to be diagnosed.
|
||||
// C++ [dcl.fct.default]p8:
|
||||
// The keyword this shall not be used in a default argument of a
|
||||
// member function.
|
||||
// Note: this requirement is already diagnosed by
|
||||
// Sema::ActOnCXXThis, because the use of "this" inside a default
|
||||
// argument doesn't occur inside the body of a non-static member
|
||||
// function.
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -36,3 +36,7 @@ void nondecl(int (*f)(int x = 5)) // {expected-error {{default arguments can onl
|
|||
void (*f2)(int = 17) // {expected-error {{default arguments can only be specified}}}
|
||||
= (void (*)(int = 42))f; // {expected-error {{default arguments can only be specified}}}
|
||||
}
|
||||
|
||||
class X {
|
||||
void f(X* x = this); // expected-error{{invalid use of 'this' outside of a nonstatic member function}}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue