1a5728872c7702ddd09537c95bc3cbd20e1f2fb09Daniel Dunbar// RUN: %clang_cc1 -fsyntax-only -verify %s
27c2342dd4c9947806842e5aca3d2bb2e542853c9John McCallstruct A; // expected-note 14 {{forward declaration of 'A'}}
311582f542e183f7a7dfcba82cc4378f42d1527c2Anders Carlsson
42fe9b7fb07dff15dd15dd8755a9a9e6de0fe46fcRichard TrieuA f(); // expected-note {{'f' declared here}}
511582f542e183f7a7dfcba82cc4378f42d1527c2Anders Carlsson
611582f542e183f7a7dfcba82cc4378f42d1527c2Anders Carlssonstruct B {
7eed3e699b581ad9e17f8147f26b882d20d65a317Anders Carlsson  A f(); // expected-note {{'f' declared here}}
807d68f1f0760110d430c4b849abd49f12777f09cAnders Carlsson  A operator()(); // expected-note 2 {{'operator()' declared here}}
9cee1b54e11cb4d460634e6ecedbe75c7c2382389Anders Carlsson  operator A(); // expected-note {{'operator A' declared here}}
1026a2a07acfacc06406e6a48c6d22e4b26bcd6382Anders Carlsson  A operator!(); // expected-note 2 {{'operator!' declared here}}
1107d68f1f0760110d430c4b849abd49f12777f09cAnders Carlsson  A operator++(int); // expected-note {{'operator++' declared here}}
123a9439f3b55a018a149953074801921fc1df63b7Anders Carlsson  A operator[](int); // expected-note {{'operator[]' declared here}}
1315ea378083ee4d9e4838076e4a310177da3d46c4Anders Carlsson  A operator+(int); // expected-note {{'operator+' declared here}}
1415ea378083ee4d9e4838076e4a310177da3d46c4Anders Carlsson  A operator->(); // expected-note {{'operator->' declared here}}
1511582f542e183f7a7dfcba82cc4378f42d1527c2Anders Carlsson};
1611582f542e183f7a7dfcba82cc4378f42d1527c2Anders Carlsson
1711582f542e183f7a7dfcba82cc4378f42d1527c2Anders Carlssonvoid g() {
187c2342dd4c9947806842e5aca3d2bb2e542853c9John McCall  f(); // expected-error {{calling 'f' with incomplete return type 'A'}}
1911582f542e183f7a7dfcba82cc4378f42d1527c2Anders Carlsson
2011582f542e183f7a7dfcba82cc4378f42d1527c2Anders Carlsson  typedef A (*Func)();
2111582f542e183f7a7dfcba82cc4378f42d1527c2Anders Carlsson  Func fp;
227c2342dd4c9947806842e5aca3d2bb2e542853c9John McCall  fp(); // expected-error {{calling function with incomplete return type 'A'}}
237c2342dd4c9947806842e5aca3d2bb2e542853c9John McCall  ((Func)0)();  // expected-error {{calling function with incomplete return type 'A'}}
24eed3e699b581ad9e17f8147f26b882d20d65a317Anders Carlsson
25eed3e699b581ad9e17f8147f26b882d20d65a317Anders Carlsson  B b;
267c2342dd4c9947806842e5aca3d2bb2e542853c9John McCall  b.f(); // expected-error {{calling 'f' with incomplete return type 'A'}}
27cee1b54e11cb4d460634e6ecedbe75c7c2382389Anders Carlsson
287c2342dd4c9947806842e5aca3d2bb2e542853c9John McCall  b.operator()(); // expected-error {{calling 'operator()' with incomplete return type 'A'}}
297c2342dd4c9947806842e5aca3d2bb2e542853c9John McCall  b.operator A(); // expected-error {{calling 'operator A' with incomplete return type 'A'}}
307c2342dd4c9947806842e5aca3d2bb2e542853c9John McCall  b.operator!(); // expected-error {{calling 'operator!' with incomplete return type 'A'}}
3126a2a07acfacc06406e6a48c6d22e4b26bcd6382Anders Carlsson
327c2342dd4c9947806842e5aca3d2bb2e542853c9John McCall  !b; // expected-error {{calling 'operator!' with incomplete return type 'A'}}
337c2342dd4c9947806842e5aca3d2bb2e542853c9John McCall  b(); // expected-error {{calling 'operator()' with incomplete return type 'A'}}
347c2342dd4c9947806842e5aca3d2bb2e542853c9John McCall  b++; // expected-error {{calling 'operator++' with incomplete return type 'A'}}
357c2342dd4c9947806842e5aca3d2bb2e542853c9John McCall  b[0]; // expected-error {{calling 'operator[]' with incomplete return type 'A'}}
367c2342dd4c9947806842e5aca3d2bb2e542853c9John McCall  b + 1; // expected-error {{calling 'operator+' with incomplete return type 'A'}}
377c2342dd4c9947806842e5aca3d2bb2e542853c9John McCall  b->f(); // expected-error {{calling 'operator->' with incomplete return type 'A'}}
388d6d90d5499d4248761251811ebed0ae77665ed7Anders Carlsson
398d6d90d5499d4248761251811ebed0ae77665ed7Anders Carlsson  A (B::*mfp)() = 0;
407c2342dd4c9947806842e5aca3d2bb2e542853c9John McCall  (b.*mfp)(); // expected-error {{calling function with incomplete return type 'A'}}
418d6d90d5499d4248761251811ebed0ae77665ed7Anders Carlsson
4211582f542e183f7a7dfcba82cc4378f42d1527c2Anders Carlsson}
434a27d7061ee2fe0e2b71aa470c323e76afb95917Douglas Gregor
444a27d7061ee2fe0e2b71aa470c323e76afb95917Douglas Gregor
454a27d7061ee2fe0e2b71aa470c323e76afb95917Douglas Gregorstruct C; // expected-note{{forward declaration}}
464a27d7061ee2fe0e2b71aa470c323e76afb95917Douglas Gregor
474a27d7061ee2fe0e2b71aa470c323e76afb95917Douglas Gregorvoid test_incomplete_object_call(C& c) {
484a27d7061ee2fe0e2b71aa470c323e76afb95917Douglas Gregor  c(); // expected-error{{incomplete type in call to object of type}}
494a27d7061ee2fe0e2b71aa470c323e76afb95917Douglas Gregor}
50