1 // RUN: rm -rf %t 2 // RUN: %clang_cc1 -x objective-c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify -DEARLY_IMPORT 3 // RUN: %clang_cc1 -x objective-c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify -UEARLY_IMPORT 4 // RUN: %clang_cc1 -x objective-c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify -DEARLY_IMPORT -fmodules-local-submodule-visibility 5 // RUN: %clang_cc1 -x objective-c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify -UEARLY_IMPORT -fmodules-local-submodule-visibility 6 7 #ifdef EARLY_IMPORT 8 @import using_decl.a; 9 namespace UsingDecl { 10 using ::merged; 11 } 12 int k = UsingDecl::merged; 13 #endif 14 15 namespace Y { 16 int conflicting_hidden_using_decl; 17 int conflicting_hidden_using_decl_fn_2(); 18 int conflicting_hidden_using_decl_var_2; 19 struct conflicting_hidden_using_decl_struct_2; 20 21 struct conflicting_hidden_using_decl_mixed_4 {}; 22 int conflicting_hidden_using_decl_mixed_5; 23 int conflicting_hidden_using_decl_mixed_6(); 24 } 25 26 using Y::conflicting_hidden_using_decl; 27 int conflicting_hidden_using_decl_fn(); 28 int conflicting_hidden_using_decl_var; 29 struct conflicting_hidden_using_decl_struct {}; 30 using Y::conflicting_hidden_using_decl_fn_2; 31 using Y::conflicting_hidden_using_decl_var_2; 32 using Y::conflicting_hidden_using_decl_struct_2; 33 34 struct conflicting_hidden_using_decl_mixed_1 {}; 35 int conflicting_hidden_using_decl_mixed_2; 36 int conflicting_hidden_using_decl_mixed_3(); 37 using Y::conflicting_hidden_using_decl_mixed_4; 38 using Y::conflicting_hidden_using_decl_mixed_5; 39 using Y::conflicting_hidden_using_decl_mixed_6; 40 41 template<typename T> int use(T); 42 void test_conflicting() { 43 use(conflicting_hidden_using_decl); 44 use(conflicting_hidden_using_decl_fn()); 45 use(conflicting_hidden_using_decl_var); 46 use(conflicting_hidden_using_decl_fn_2()); 47 use(conflicting_hidden_using_decl_var_2); 48 use(conflicting_hidden_using_decl_mixed_1()); 49 use(conflicting_hidden_using_decl_mixed_2); 50 use(conflicting_hidden_using_decl_mixed_3()); 51 use(conflicting_hidden_using_decl_mixed_4()); 52 use(conflicting_hidden_using_decl_mixed_5); 53 use(conflicting_hidden_using_decl_mixed_6()); 54 } 55 56 #ifndef EARLY_IMPORT 57 @import using_decl.a; 58 #endif 59 60 UsingDecl::using_decl_type x = UsingDecl::using_decl_var; 61 UsingDecl::inner y = x; 62 63 @import using_decl.b; 64 65 void test_conflicting_2() { 66 use(conflicting_hidden_using_decl); // expected-error {{ambiguous}} 67 use(conflicting_hidden_using_decl_fn()); // expected-error {{ambiguous}} 68 use(conflicting_hidden_using_decl_var); // expected-error {{ambiguous}} 69 use(conflicting_hidden_using_decl_fn_2()); // expected-error {{ambiguous}} 70 use(conflicting_hidden_using_decl_var_2); // expected-error {{ambiguous}} 71 use(conflicting_hidden_using_decl_mixed_1); // ok, struct hidden 72 use(conflicting_hidden_using_decl_mixed_2); // expected-error {{ambiguous}} 73 use(conflicting_hidden_using_decl_mixed_3); // ok, struct hidden 74 use(conflicting_hidden_using_decl_mixed_4); // ok, struct hidden 75 use(conflicting_hidden_using_decl_mixed_5); // expected-error {{ambiguous}} 76 use(conflicting_hidden_using_decl_mixed_6); // ok, struct hidden 77 // expected-note (at) using-decl.cpp:* 7{{candidate}} 78 // expected-note (at) using-decl-b.h:* 7{{candidate}} 79 80 int conflicting_hidden_using_decl_mixed_1::*p1; 81 int conflicting_hidden_using_decl_mixed_3::*p3; 82 int conflicting_hidden_using_decl_mixed_4::*p4; 83 int conflicting_hidden_using_decl_mixed_6::*p6; 84 } 85