Richard Smith | 65ebb4a | 2015-03-26 04:09:53 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
Richard Smith | 0279375 | 2015-03-27 21:16:39 +0000 | [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 |
Richard Smith | be3980b | 2015-03-27 00:41:57 +0000 | [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 |
Richard Smith | 65ebb4a | 2015-03-26 04:09:53 +0000 | [diff] [blame] | 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'}} |
Richard Smith | 9a71c99 | 2015-03-27 20:16:58 +0000 | [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}} |
Richard Smith | 65ebb4a | 2015-03-26 04:09:53 +0000 | [diff] [blame] | 12 | |
Richard Smith | be3980b | 2015-03-27 00:41:57 +0000 | [diff] [blame] | 13 | B::Inner2 pre_bi; // expected-error +{{must be imported}} |
| 14 | // expected-note@defs.h:4 +{{here}} |
| 15 | // expected-note@defs.h:10 +{{here}} |
| 16 | |
| 17 | C_Base<1> pre_cb1; // expected-error +{{must be imported}} |
| 18 | // expected-note@defs.h:13 +{{here}} |
| 19 | C1 pre_c1; // expected-error +{{must be imported}} expected-error {{must use 'struct'}} |
| 20 | // expected-note@defs.h:15 +{{here}} |
| 21 | C2 pre_c2; // expected-error +{{must be imported}} expected-error {{must use 'struct'}} |
| 22 | // expected-note@defs.h:16 +{{here}} |
| 23 | |
Richard Smith | a523022 | 2015-03-27 01:37:43 +0000 | [diff] [blame] | 24 | D::X pre_dx; // expected-error +{{must be imported}} |
| 25 | // expected-note@defs.h:18 +{{here}} |
| 26 | // expected-note@defs.h:19 +{{here}} |
Richard Smith | 9a71c99 | 2015-03-27 20:16:58 +0000 | [diff] [blame] | 27 | // FIXME: We should warn that use_dx is being used without being imported. |
| 28 | int pre_use_dx = use_dx(pre_dx); |
Richard Smith | a523022 | 2015-03-27 01:37:43 +0000 | [diff] [blame] | 29 | |
Richard Smith | 65ebb4a | 2015-03-26 04:09:53 +0000 | [diff] [blame] | 30 | // Make definitions from second module visible. |
Richard Smith | 0279375 | 2015-03-27 21:16:39 +0000 | [diff] [blame^] | 31 | #ifdef TEXTUAL |
Richard Smith | 65ebb4a | 2015-03-26 04:09:53 +0000 | [diff] [blame] | 32 | #include "import-and-redefine.h" |
Richard Smith | 0279375 | 2015-03-27 21:16:39 +0000 | [diff] [blame^] | 33 | #else |
| 34 | #include "merged-defs.h" |
| 35 | #endif |
Richard Smith | 65ebb4a | 2015-03-26 04:09:53 +0000 | [diff] [blame] | 36 | |
| 37 | A post_a; |
Richard Smith | 9a71c99 | 2015-03-27 20:16:58 +0000 | [diff] [blame] | 38 | int post_use_a = use_a(post_a); |
Richard Smith | be3980b | 2015-03-27 00:41:57 +0000 | [diff] [blame] | 39 | B::Inner2 post_bi; |
| 40 | C_Base<1> post_cb1; |
| 41 | C1 c1; |
| 42 | C2 c2; |
Richard Smith | a523022 | 2015-03-27 01:37:43 +0000 | [diff] [blame] | 43 | D::X post_dx; |
Richard Smith | 9a71c99 | 2015-03-27 20:16:58 +0000 | [diff] [blame] | 44 | int post_use_dx = use_dx(post_dx); |