blob: 7021d14f6984acc18982e2827b674e27b6dbf016 [file] [log] [blame]
Douglas Gregora1be2782011-12-17 23:38:30 +00001// RUN: rm -rf %t
2// RUN: %clang_cc1 -fmodule-cache-path %t -I %S/Inputs %s -verify
Douglas Gregor68d7bb92011-12-19 14:42:41 +00003// RUN: %clang_cc1 -x objective-c++ -fmodule-cache-path %t -I %S/Inputs %s -verify
Douglas Gregora1be2782011-12-17 23:38:30 +00004__import_module__ redecl_merge_left;
5__import_module__ redecl_merge_right;
6
7@implementation A
8- (Super*)init { return self; }
9@end
10
11void f(A *a) {
12 [a init];
13}
14
15@class A;
16
Douglas Gregoradafc2e2011-12-19 16:14:14 +000017B *f1() {
18 return [B create_a_B];
19}
20
Douglas Gregorecb19382011-12-19 15:27:36 +000021@class B;
22
Douglas Gregor2ccd89c2011-12-20 18:11:52 +000023// Test redeclarations of entities in explicit submodules, to make
24// sure we're maintaining the declaration chains even when normal name
25// lookup can't see what we're looking for.
26void testExplicit() {
27 Explicit *e;
28 int *(*fp)(void) = &explicit_func;
29 int *ip = explicit_func();
30
31 // FIXME: Should complain about definition not having been imported.
32 struct explicit_struct es = { 0 };
33}
34
Douglas Gregora1be2782011-12-17 23:38:30 +000035__import_module__ redecl_merge_bottom;
36
Douglas Gregorecb19382011-12-19 15:27:36 +000037@implementation B
Douglas Gregoradafc2e2011-12-19 16:14:14 +000038+ (B*)create_a_B { return 0; }
Douglas Gregorecb19382011-12-19 15:27:36 +000039@end
40
Douglas Gregora1be2782011-12-17 23:38:30 +000041void g(A *a) {
42 [a init];
43}
Douglas Gregorf63b0a52011-12-19 18:19:24 +000044
45#ifdef __cplusplus
46void testVector() {
Douglas Gregorfc529f72011-12-19 19:00:47 +000047 Vector<int> vec_int;
48 vec_int.push_back(0);
Douglas Gregorf63b0a52011-12-19 18:19:24 +000049}
50#endif