blob: efd2d7c42c83743ae7d192bb44dcc35e7bb7291d [file] [log] [blame]
Douglas Gregor6bd99292013-02-09 01:35:03 +00001// RUN: rm -rf %t
Richard Smithd67679d2013-08-20 20:35:18 +00002// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_EARLY
Douglas Gregor6bd99292013-02-09 01:35:03 +00003// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify
4
Richard Smithd67679d2013-08-20 20:35:18 +00005// expected-note@Inputs/def.h:5 {{previous}}
Douglas Gregor6bd99292013-02-09 01:35:03 +00006
7@class Def;
8Def *def;
9
10@import decldef;
Richard Smithd67679d2013-08-20 20:35:18 +000011#ifdef USE_EARLY
12A *a1; // expected-error{{declaration of 'A' must be imported from module 'decldef.Def' before it is required}}
13#endif
Douglas Gregor6bd99292013-02-09 01:35:03 +000014B *b1; // expected-error{{must use 'struct' tag to refer to type 'B'}}
15@import decldef.Decl;
16
17A *a2;
18struct B *b;
19
20void testA(A *a) {
Richard Smithd67679d2013-08-20 20:35:18 +000021 a->ivar = 17;
22#ifndef USE_EARLY
23 // expected-error@-2{{definition of 'A' must be imported from module 'decldef.Def' before it is required}}
24#endif
Douglas Gregor6bd99292013-02-09 01:35:03 +000025}
26
27void testB() {
28 B b; // Note: redundant error silenced
29}
30
31void testDef() {
32 [def defMethod];
33}