[cfe-commits] r83694 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaCXX/incomplete-call.cpp
Anders Carlsson
andersca at mac.com
Fri Oct 9 17:06:20 PDT 2009
Author: andersca
Date: Fri Oct 9 19:06:20 2009
New Revision: 83694
URL: http://llvm.org/viewvc/llvm-project?rev=83694&view=rev
Log:
Check that the return type is complete when calling a member function.
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/SemaCXX/incomplete-call.cpp
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=83694&r1=83693&r2=83694&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Oct 9 19:06:20 2009
@@ -4818,6 +4818,11 @@
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))
Modified: cfe/trunk/test/SemaCXX/incomplete-call.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/incomplete-call.cpp?rev=83694&r1=83693&r2=83694&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/incomplete-call.cpp (original)
+++ cfe/trunk/test/SemaCXX/incomplete-call.cpp Fri Oct 9 19:06:20 2009
@@ -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 @@
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'}}
}
More information about the cfe-commits
mailing list