blob: 593f53b2c6cf2638cfe837ad3ee1f2a5fba70e90 [file] [log] [blame]
Douglas Gregor55368912011-12-14 16:03:29 +00001// RUN: rm -rf %t
Douglas Gregor6bd99292013-02-09 01:35:03 +00002// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify
Douglas Gregor55368912011-12-14 16:03:29 +00003
Andy Gibbsb42f2002013-04-17 08:06:46 +00004// expected-note@Inputs/def.h:5 {{previous definition is here}}
Douglas Gregord07cc362012-01-02 17:18:37 +00005
Douglas Gregor6bd99292013-02-09 01:35:03 +00006@class Def;
7Def *def;
8class Def2;
9Def2 *def2;
10
11@interface Unrelated
12- defMethod;
13@end
14
Douglas Gregor1b257af2012-12-11 22:11:52 +000015@import decldef;
Douglas Gregor55368912011-12-14 16:03:29 +000016A *a1; // expected-error{{unknown type name 'A'}}
17B *b1; // expected-error{{unknown type name 'B'}}
Douglas Gregor1b257af2012-12-11 22:11:52 +000018@import decldef.Decl;
Douglas Gregor55368912011-12-14 16:03:29 +000019
Douglas Gregord63348c2011-12-15 20:36:27 +000020A *a2;
Douglas Gregor55368912011-12-14 16:03:29 +000021B *b;
22
Douglas Gregord07cc362012-01-02 17:18:37 +000023void testA(A *a) {
Douglas Gregorca2ab452013-01-12 01:29:50 +000024 a->ivar = 17; // expected-error{{definition of 'A' must be imported from module 'decldef.Def' before it is required}}
Douglas Gregord07cc362012-01-02 17:18:37 +000025}
26
Douglas Gregor55368912011-12-14 16:03:29 +000027void testB() {
Douglas Gregorca2ab452013-01-12 01:29:50 +000028 B b; // Note: redundant error silenced
Douglas Gregor55368912011-12-14 16:03:29 +000029}
Douglas Gregor6bd99292013-02-09 01:35:03 +000030
31void testDef() {
32 [def defMethod];
33}
34
35void testDef2() {
36 def2->func();
37}