diff options
| author | Anders Carlsson <andersca@mac.com> | 2009-10-09 23:51:55 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2009-10-09 23:51:55 +0000 |
| commit | 7f84ed928721b49670024fd711ebbc276f038992 (patch) | |
| tree | d9c29ffb53a7af9d7f23dababeae2caf10c93f9a /clang/test | |
| parent | 918ec53c647f13885cf05d71845e325725d2d2f7 (diff) | |
| download | bcm5719-llvm-7f84ed928721b49670024fd711ebbc276f038992.tar.gz bcm5719-llvm-7f84ed928721b49670024fd711ebbc276f038992.zip | |
Add CheckCallReturnType and start using it for regular call expressions. This will improve error messages. For
struct B;
B f();
void g() {
f();
}
We now get
t.cpp:6:3: error: calling 'f' with incomplete return type 'struct B'
f();
^~~
t.cpp:3:3: note: 'f' declared here
B f();
^
t.cpp:1:8: note: forward declaration of 'struct B'
struct B;
^
llvm-svn: 83692
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p9.cpp | 4 | ||||
| -rw-r--r-- | clang/test/Sema/incomplete-call.c | 4 | ||||
| -rw-r--r-- | clang/test/SemaCXX/enum.cpp | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/clang/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p9.cpp b/clang/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p9.cpp index 5d9f9e7a51c..907a91a86ec 100644 --- a/clang/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p9.cpp +++ b/clang/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p9.cpp @@ -2,11 +2,11 @@ struct S; // expected-note {{forward declaration of 'struct S'}} extern S a; -extern S f(); +extern S f(); // expected-note {{'f' declared here}} extern void g(S a); // expected-note {{candidate function}} void h() { // FIXME: This diagnostic could be better. g(a); // expected-error {{no matching function for call to 'g'}} - f(); // expected-error {{return type of called function ('struct S') is incomplete}} + f(); // expected-error {{calling 'f' with incomplete return type 'struct S'}} } diff --git a/clang/test/Sema/incomplete-call.c b/clang/test/Sema/incomplete-call.c index aedfe50bbfd..15d97683c5a 100644 --- a/clang/test/Sema/incomplete-call.c +++ b/clang/test/Sema/incomplete-call.c @@ -2,12 +2,12 @@ struct foo; // expected-note 3 {{forward declaration of 'struct foo'}} -struct foo a(); +struct foo a(); // expected-note {{'a' declared here}} void b(struct foo); void c(); void func() { - a(); // expected-error{{return type of called function ('struct foo') is incomplete}} + a(); // expected-error{{calling 'a' with incomplete return type 'struct foo'}} b(*(struct foo*)0); // expected-error{{argument type 'struct foo' is incomplete}} c(*(struct foo*)0); // expected-error{{argument type 'struct foo' is incomplete}} } diff --git a/clang/test/SemaCXX/enum.cpp b/clang/test/SemaCXX/enum.cpp index 431f457259f..db256812ab8 100644 --- a/clang/test/SemaCXX/enum.cpp +++ b/clang/test/SemaCXX/enum.cpp @@ -31,7 +31,7 @@ struct s1 { enum e1 { YES, NO }; static enum e1 badfunc(struct s1 *q) { - return q->bar(); // expected-error{{return type of called function ('enum s1::e1') is incomplete}} + return q->bar(); // expected-error{{calling function with incomplete return type 'enum s1::e1'}} } enum e2; // expected-error{{ISO C++ forbids forward references to 'enum' types}} |

