blob: 4decd864832af8cd99e098930dd5e30777145151 [file] [log] [blame]
Anders Carlsson11582f52009-10-09 23:58:25 +00001// RUN: clang-cc -fsyntax-only -verify %s
Anders Carlsson3a9439f2009-10-13 22:22:09 +00002struct A; // expected-note 11 {{forward declaration of 'struct 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 Carlsson11582f52009-10-09 23:58:25 +000013};
14
15void g() {
16 f(); // expected-error {{calling 'f' with incomplete return type 'struct A'}}
17
18 typedef A (*Func)();
19 Func fp;
20 fp(); // expected-error {{calling function with incomplete return type 'struct A'}}
21 ((Func)0)(); // expected-error {{calling function with incomplete return type 'struct A'}}
Anders Carlssoneed3e692009-10-10 00:06:20 +000022
23 B b;
24 b.f(); // expected-error {{calling 'f' with incomplete return type 'struct A'}}
Anders Carlssoncee1b542009-10-13 21:02:07 +000025
26 b.operator()(); // expected-error {{calling 'operator()' with incomplete return type 'struct A'}}
27 b.operator A(); // expected-error {{calling 'operator A' with incomplete return type 'struct A'}}
Anders Carlsson26a2a072009-10-13 21:19:37 +000028 b.operator!(); // expected-error {{calling 'operator!' with incomplete return type 'struct A'}}
29
30 !b; // expected-error {{calling 'operator!' with incomplete return type 'struct A'}}
Anders Carlsson07d68f12009-10-13 21:49:31 +000031 b(); // expected-error {{calling 'operator()' with incomplete return type 'struct A'}}
32 b++; // expected-error {{calling 'operator++' with incomplete return type 'struct A'}}
Anders Carlsson3a9439f2009-10-13 22:22:09 +000033 b[0]; // expected-error {{calling 'operator[]' with incomplete return type 'struct A'}}
Anders Carlsson11582f52009-10-09 23:58:25 +000034}