forked from OSchip/llvm-project
Check that the return type is complete when calling a member function.
llvm-svn: 83694
This commit is contained in:
parent
1040f2e9db
commit
c4859baea4
|
@ -4818,6 +4818,11 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
|
|||
Method->getResultType().getNonReferenceType(),
|
||||
RParenLoc));
|
||||
|
||||
// Check for a valid return type.
|
||||
if (CheckCallReturnType(Method->getResultType(), MemExpr->getMemberLoc(),
|
||||
TheCall.get(), Method))
|
||||
return true;
|
||||
|
||||
// Convert the object argument (for a non-static member function call).
|
||||
if (!Method->isStatic() &&
|
||||
PerformObjectArgumentInitialization(ObjectArg, Method))
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
// RUN: clang-cc -fsyntax-only -verify %s
|
||||
struct A; // expected-note 3 {{forward declaration of 'struct A'}}
|
||||
struct A; // expected-note 4 {{forward declaration of 'struct A'}}
|
||||
|
||||
A f(); // expected-note {{note: 'f' declared here}}
|
||||
|
||||
struct B {
|
||||
A f(); // expected-note {{'f' declared here}}
|
||||
};
|
||||
|
||||
void g() {
|
||||
|
@ -13,4 +14,7 @@ void g() {
|
|||
Func fp;
|
||||
fp(); // expected-error {{calling function with incomplete return type 'struct A'}}
|
||||
((Func)0)(); // expected-error {{calling function with incomplete return type 'struct A'}}
|
||||
|
||||
B b;
|
||||
b.f(); // expected-error {{calling 'f' with incomplete return type 'struct A'}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue