2 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -Wreturn-type -fmodules-cache-path=%t -I %S/Inputs %s -verify -Wno-objc-root-class
7 @import redecl_merge_left;
8 typedef struct my_struct_type *my_struct_ref;
13 int *call_eventually_noreturn(void) {
14 eventually_noreturn();
15 } // expected-warning{{non-void function does not return a value}}
17 int *call_eventually_noreturn2(void) {
18 eventually_noreturn2();
19 } // expected-warning{{non-void function does not return a value}}
21 @import redecl_merge_right;
23 int *call_eventually_noreturn_again(void) {
24 eventually_noreturn();
27 int *call_eventually_noreturn2_again(void) {
28 // noreturn and non-noreturn functions have different types
29 eventually_noreturn2(); // expected-error{{call to 'eventually_noreturn2' is ambiguous}}
30 // expected-note@Inputs/redecl-merge-left.h:93{{candidate function}}
31 // expected-note@Inputs/redecl-merge-right.h:90{{candidate function}}
35 - (Super*)init { return self; }
45 return [B create_a_B];
50 void testProtoMerge(id<P1> p1, id<P2> p2) {
63 void testTagMerge(void) {
64 consume_S1(produce_S1());
67 consume_S2(produce_S2());
70 consume_S3(produce_S3());
73 consume_S4(produce_S4());
78 void testTypedefMerge(int i, double d) {
80 // FIXME: Typedefs aren't actually merged in the sense of other merges, because
81 // we should only merge them when the types are identical.
82 // expected-note@Inputs/redecl-merge-left.h:60{{candidate found by name lookup is 'T2'}}
83 // expected-note@Inputs/redecl-merge-right.h:63{{candidate found by name lookup is 'T2'}}
84 T2 *dp = &d; // expected-error{{reference to 'T2' is ambiguous}}
87 void testFuncMerge(int i) {
90 // expected-note@Inputs/redecl-merge-left.h:64{{candidate function}}
91 // expected-note@Inputs/redecl-merge-right.h:70{{candidate function}}
92 func2(i); // expected-error{{call to 'func2' is ambiguous}}
95 void testVarMerge(int i) {
97 // expected-note@Inputs/redecl-merge-left.h:77{{candidate found by name lookup is 'var2'}}
98 // expected-note@Inputs/redecl-merge-right.h:77{{candidate found by name lookup is 'var2'}}
99 var2 = i; // expected-error{{reference to 'var2' is ambiguous}}
100 // expected-note@Inputs/redecl-merge-left.h:79{{candidate found by name lookup is 'var3'}}
101 // expected-note@Inputs/redecl-merge-right.h:79{{candidate found by name lookup is 'var3'}}
102 var3 = i; // expected-error{{reference to 'var3' is ambiguous}}
105 // Test redeclarations of entities in explicit submodules, to make
106 // sure we're maintaining the declaration chains even when normal name
107 // lookup can't see what we're looking for.
108 void testExplicit(void) {
110 int *(*fp)(void) = &explicit_func;
111 int *ip = explicit_func();
113 // FIXME: Should complain about definition not having been imported.
114 struct explicit_struct es = { 0 };
117 // Test resolution of declarations from multiple modules with no
118 // common original declaration.
124 void test_C2(C2 *c2) {
129 void test_C3(C3 *c3) {
138 @import redecl_merge_left_left;
140 void test_C4a(C4 *c4) {
141 global_C4 = c4 = get_a_C4();
145 void test_ClassWithDef(ClassWithDef *cwd) {
149 @import redecl_merge_bottom;
151 void test_C4b(void) {
157 + (B*)create_a_B { return 0; }
171 // Make sure we don't get conflicts with 'id'.