1// RUN: rm -rf %t
2// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_EARLY
3// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify
4
5// expected-note@Inputs/def.h:5 {{previous}}
6
7@class Def;
8Def *def;
9
10@import decldef;
11#ifdef USE_EARLY
12A *a1; // expected-error{{declaration of 'A' must be imported from module 'decldef.Def' before it is required}}
13#endif
14B *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) {
21  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
25}
26
27void testB() {
28  B b; // Note: redundant error silenced
29}
30
31void testDef() {
32  [def defMethod];
33}
34