1*f4a2713aSLionel Sambuc// RUN: rm -rf %t
2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_EARLY
3*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify
4*f4a2713aSLionel Sambuc
5*f4a2713aSLionel Sambuc// expected-note@Inputs/def.h:5 {{previous}}
6*f4a2713aSLionel Sambuc
7*f4a2713aSLionel Sambuc@class Def;
8*f4a2713aSLionel SambucDef *def;
9*f4a2713aSLionel Sambuc
10*f4a2713aSLionel Sambuc@import decldef;
11*f4a2713aSLionel Sambuc#ifdef USE_EARLY
12*f4a2713aSLionel SambucA *a1; // expected-error{{declaration of 'A' must be imported from module 'decldef.Def' before it is required}}
13*f4a2713aSLionel Sambuc#endif
14*f4a2713aSLionel SambucB *b1; // expected-error{{must use 'struct' tag to refer to type 'B'}}
15*f4a2713aSLionel Sambuc@import decldef.Decl;
16*f4a2713aSLionel Sambuc
17*f4a2713aSLionel SambucA *a2;
18*f4a2713aSLionel Sambucstruct B *b;
19*f4a2713aSLionel Sambuc
20*f4a2713aSLionel Sambucvoid testA(A *a) {
21*f4a2713aSLionel Sambuc  a->ivar = 17;
22*f4a2713aSLionel Sambuc#ifndef USE_EARLY
23*f4a2713aSLionel Sambuc  // expected-error@-2{{definition of 'A' must be imported from module 'decldef.Def' before it is required}}
24*f4a2713aSLionel Sambuc#endif
25*f4a2713aSLionel Sambuc}
26*f4a2713aSLionel Sambuc
27*f4a2713aSLionel Sambucvoid testB() {
28*f4a2713aSLionel Sambuc  B b; // Note: redundant error silenced
29*f4a2713aSLionel Sambuc}
30*f4a2713aSLionel Sambuc
31*f4a2713aSLionel Sambucvoid testDef() {
32*f4a2713aSLionel Sambuc  [def defMethod];
33*f4a2713aSLionel Sambuc}
34