Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 1 | // RUN: rm -rf %t |
Pirama Arumuga Nainar | 33337ca | 2015-05-06 11:48:57 -0700 | [diff] [blame] | 2 | // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -DTEXTUAL |
Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 3 | // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery |
| 4 | |
| 5 | // Trigger import of definitions, but don't make them visible. |
| 6 | #include "empty.h" |
| 7 | |
| 8 | A pre_a; // expected-error {{must be imported}} expected-error {{must use 'struct'}} |
Pirama Arumuga Nainar | 33337ca | 2015-05-06 11:48:57 -0700 | [diff] [blame] | 9 | // expected-note@defs.h:1 +{{here}} |
| 10 | // FIXME: We should warn that use_a is being used without being imported. |
| 11 | int pre_use_a = use_a(pre_a); // expected-error {{'A' must be imported}} |
Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 12 | |
| 13 | B::Inner2 pre_bi; // expected-error +{{must be imported}} |
| 14 | // expected-note@defs.h:4 +{{here}} |
Pirama Arumuga Nainar | 33337ca | 2015-05-06 11:48:57 -0700 | [diff] [blame] | 15 | // expected-note@defs.h:11 +{{here}} |
Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 16 | |
| 17 | C_Base<1> pre_cb1; // expected-error +{{must be imported}} |
Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 18 | // expected-note@defs.h:15 +{{here}} |
Pirama Arumuga Nainar | 33337ca | 2015-05-06 11:48:57 -0700 | [diff] [blame] | 19 | C1 pre_c1; // expected-error +{{must be imported}} expected-error {{must use 'struct'}} |
| 20 | // expected-note@defs.h:17 +{{here}} |
Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 21 | C2 pre_c2; // expected-error +{{must be imported}} expected-error {{must use 'struct'}} |
Pirama Arumuga Nainar | 33337ca | 2015-05-06 11:48:57 -0700 | [diff] [blame] | 22 | // expected-note@defs.h:18 +{{here}} |
Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 23 | |
| 24 | D::X pre_dx; // expected-error +{{must be imported}} |
Pirama Arumuga Nainar | 33337ca | 2015-05-06 11:48:57 -0700 | [diff] [blame] | 25 | // expected-note@defs.h:20 +{{here}} |
| 26 | // expected-note@defs.h:21 +{{here}} |
| 27 | // FIXME: We should warn that use_dx is being used without being imported. |
| 28 | int pre_use_dx = use_dx(pre_dx); |
| 29 | |
| 30 | int pre_e = E(0); // expected-error {{must be imported}} |
| 31 | // expected-note@defs.h:24 +{{here}} |
| 32 | |
| 33 | int pre_ff = F<int>().f(); // expected-error +{{must be imported}} |
| 34 | int pre_fg = F<int>().g<int>(); // expected-error +{{must be imported}} |
| 35 | // expected-note@defs.h:26 +{{here}} |
Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 36 | |
| 37 | // Make definitions from second module visible. |
Pirama Arumuga Nainar | 33337ca | 2015-05-06 11:48:57 -0700 | [diff] [blame] | 38 | #ifdef TEXTUAL |
Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 39 | #include "import-and-redefine.h" |
Pirama Arumuga Nainar | 33337ca | 2015-05-06 11:48:57 -0700 | [diff] [blame] | 40 | #else |
| 41 | #include "merged-defs.h" |
| 42 | #endif |
Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 43 | |
| 44 | A post_a; |
Pirama Arumuga Nainar | 33337ca | 2015-05-06 11:48:57 -0700 | [diff] [blame] | 45 | int post_use_a = use_a(post_a); |
Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 46 | B::Inner2 post_bi; |
| 47 | C_Base<1> post_cb1; |
| 48 | C1 c1; |
| 49 | C2 c2; |
| 50 | D::X post_dx; |
Pirama Arumuga Nainar | 33337ca | 2015-05-06 11:48:57 -0700 | [diff] [blame] | 51 | int post_use_dx = use_dx(post_dx); |
| 52 | int post_e = E(0); |
| 53 | int post_ff = F<char>().f(); |
| 54 | int post_fg = F<char>().g<int>(); |