blob: d627c33d83526ada7c06503915d0beda017e9dd2 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
John McCall7c2342d2010-03-10 11:27:22 +00002struct A; // expected-note 14 {{forward declaration of 'A'}}
Anders Carlsson11582f52009-10-09 23:58:25 +00003
4A f(); // expected-note {{note: 'f' declared here}}
5
6struct B {
Anders Carlssoneed3e692009-10-10 00:06:20 +00007 A f(); // expected-note {{'f' declared here}}
Anders Carlsson07d68f12009-10-13 21:49:31 +00008 A operator()(); // expected-note 2 {{'operator()' declared here}}
Anders Carlssoncee1b542009-10-13 21:02:07 +00009 operator A(); // expected-note {{'operator A' declared here}}
Anders Carlsson26a2a072009-10-13 21:19:37 +000010 A operator!(); // expected-note 2 {{'operator!' declared here}}
Anders Carlsson07d68f12009-10-13 21:49:31 +000011 A operator++(int); // expected-note {{'operator++' declared here}}
Anders Carlsson3a9439f2009-10-13 22:22:09 +000012 A operator[](int); // expected-note {{'operator[]' declared here}}
Anders Carlsson15ea3782009-10-13 22:43:21 +000013 A operator+(int); // expected-note {{'operator+' declared here}}
14 A operator->(); // expected-note {{'operator->' declared here}}
Anders Carlsson11582f52009-10-09 23:58:25 +000015};
16
17void g() {
John McCall7c2342d2010-03-10 11:27:22 +000018 f(); // expected-error {{calling 'f' with incomplete return type 'A'}}
Anders Carlsson11582f52009-10-09 23:58:25 +000019
20 typedef A (*Func)();
21 Func fp;
John McCall7c2342d2010-03-10 11:27:22 +000022 fp(); // expected-error {{calling function with incomplete return type 'A'}}
23 ((Func)0)(); // expected-error {{calling function with incomplete return type 'A'}}
Anders Carlssoneed3e692009-10-10 00:06:20 +000024
25 B b;
John McCall7c2342d2010-03-10 11:27:22 +000026 b.f(); // expected-error {{calling 'f' with incomplete return type 'A'}}
Anders Carlssoncee1b542009-10-13 21:02:07 +000027
John McCall7c2342d2010-03-10 11:27:22 +000028 b.operator()(); // expected-error {{calling 'operator()' with incomplete return type 'A'}}
29 b.operator A(); // expected-error {{calling 'operator A' with incomplete return type 'A'}}
30 b.operator!(); // expected-error {{calling 'operator!' with incomplete return type 'A'}}
Anders Carlsson26a2a072009-10-13 21:19:37 +000031
John McCall7c2342d2010-03-10 11:27:22 +000032 !b; // expected-error {{calling 'operator!' with incomplete return type 'A'}}
33 b(); // expected-error {{calling 'operator()' with incomplete return type 'A'}}
34 b++; // expected-error {{calling 'operator++' with incomplete return type 'A'}}
35 b[0]; // expected-error {{calling 'operator[]' with incomplete return type 'A'}}
36 b + 1; // expected-error {{calling 'operator+' with incomplete return type 'A'}}
37 b->f(); // expected-error {{calling 'operator->' with incomplete return type 'A'}}
Anders Carlsson8d6d90d2009-10-15 00:41:48 +000038
39 A (B::*mfp)() = 0;
John McCall7c2342d2010-03-10 11:27:22 +000040 (b.*mfp)(); // expected-error {{calling function with incomplete return type 'A'}}
Anders Carlsson8d6d90d2009-10-15 00:41:48 +000041
Anders Carlsson11582f52009-10-09 23:58:25 +000042}
Douglas Gregor4a27d702009-10-21 06:18:39 +000043
44
45struct C; // expected-note{{forward declaration}}
46
47void test_incomplete_object_call(C& c) {
48 c(); // expected-error{{incomplete type in call to object of type}}
49}