1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc struct A; // expected-note 14 {{forward declaration of 'A'}}
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambuc A f(); // expected-note {{'f' declared here}}
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuc struct B {
7*f4a2713aSLionel Sambuc A f(); // expected-note {{'f' declared here}}
8*f4a2713aSLionel Sambuc A operator()(); // expected-note 2 {{'operator()' declared here}}
9*f4a2713aSLionel Sambuc operator A(); // expected-note {{'operator A' declared here}}
10*f4a2713aSLionel Sambuc A operator!(); // expected-note 2 {{'operator!' declared here}}
11*f4a2713aSLionel Sambuc A operator++(int); // expected-note {{'operator++' declared here}}
12*f4a2713aSLionel Sambuc A operator[](int); // expected-note {{'operator[]' declared here}}
13*f4a2713aSLionel Sambuc A operator+(int); // expected-note {{'operator+' declared here}}
14*f4a2713aSLionel Sambuc A operator->(); // expected-note {{'operator->' declared here}}
15*f4a2713aSLionel Sambuc };
16*f4a2713aSLionel Sambuc
g()17*f4a2713aSLionel Sambuc void g() {
18*f4a2713aSLionel Sambuc f(); // expected-error {{calling 'f' with incomplete return type 'A'}}
19*f4a2713aSLionel Sambuc
20*f4a2713aSLionel Sambuc typedef A (*Func)();
21*f4a2713aSLionel Sambuc Func fp;
22*f4a2713aSLionel Sambuc fp(); // expected-error {{calling function with incomplete return type 'A'}}
23*f4a2713aSLionel Sambuc ((Func)0)(); // expected-error {{calling function with incomplete return type 'A'}}
24*f4a2713aSLionel Sambuc
25*f4a2713aSLionel Sambuc B b;
26*f4a2713aSLionel Sambuc b.f(); // expected-error {{calling 'f' with incomplete return type 'A'}}
27*f4a2713aSLionel Sambuc
28*f4a2713aSLionel Sambuc b.operator()(); // expected-error {{calling 'operator()' with incomplete return type 'A'}}
29*f4a2713aSLionel Sambuc b.operator A(); // expected-error {{calling 'operator A' with incomplete return type 'A'}}
30*f4a2713aSLionel Sambuc b.operator!(); // expected-error {{calling 'operator!' with incomplete return type 'A'}}
31*f4a2713aSLionel Sambuc
32*f4a2713aSLionel Sambuc !b; // expected-error {{calling 'operator!' with incomplete return type 'A'}}
33*f4a2713aSLionel Sambuc b(); // expected-error {{calling 'operator()' with incomplete return type 'A'}}
34*f4a2713aSLionel Sambuc b++; // expected-error {{calling 'operator++' with incomplete return type 'A'}}
35*f4a2713aSLionel Sambuc b[0]; // expected-error {{calling 'operator[]' with incomplete return type 'A'}}
36*f4a2713aSLionel Sambuc b + 1; // expected-error {{calling 'operator+' with incomplete return type 'A'}}
37*f4a2713aSLionel Sambuc b->f(); // expected-error {{calling 'operator->' with incomplete return type 'A'}}
38*f4a2713aSLionel Sambuc
39*f4a2713aSLionel Sambuc A (B::*mfp)() = 0;
40*f4a2713aSLionel Sambuc (b.*mfp)(); // expected-error {{calling function with incomplete return type 'A'}}
41*f4a2713aSLionel Sambuc
42*f4a2713aSLionel Sambuc }
43*f4a2713aSLionel Sambuc
44*f4a2713aSLionel Sambuc
45*f4a2713aSLionel Sambuc struct C; // expected-note{{forward declaration}}
46*f4a2713aSLionel Sambuc
test_incomplete_object_call(C & c)47*f4a2713aSLionel Sambuc void test_incomplete_object_call(C& c) {
48*f4a2713aSLionel Sambuc c(); // expected-error{{incomplete type in call to object of type}}
49*f4a2713aSLionel Sambuc }
50