blob: 6ca5c6eab4f9b045d64e27934ac74e43069e782f [file] [log] [blame]
Richard Smithb920f852017-10-11 01:19:11 +00001// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fno-modules-error-recovery -fno-spell-checking -verify %s
2
3#pragma clang module build a
4module a { explicit module b {} explicit module c {} }
5#pragma clang module contents
6
7#pragma clang module begin a.b
8namespace b { int n; }
9#pragma clang module end
10
11#pragma clang module begin a.c
12#pragma clang module import a.b
13namespace c { using namespace b; }
14#pragma clang module end
15
16#pragma clang module begin a
17#pragma clang module import a.c
18using namespace c;
19#pragma clang module end
20
21#pragma clang module endbuild
22
23#pragma clang module import a.b
24void use1() {
25 (void)n; // expected-error {{use of undeclared identifier}}
26 (void)::n; // expected-error {{no member named 'n' in the global namespace}}
27 (void)b::n;
28}
29namespace b {
30 void use1_in_b() { (void)n; }
31}
32namespace c {
33 void use1_in_c() { (void)n; } // expected-error {{use of undeclared identifier}}
34}
35
36#pragma clang module import a.c
37void use2() {
38 (void)n; // expected-error {{use of undeclared identifier}}
39 (void)::n; // expected-error {{no member named 'n' in the global namespace}}
40 (void)b::n;
41 (void)c::n;
42}
43namespace b {
44 void use2_in_b() { (void)n; }
45}
46namespace c {
47 void use2_in_c() { (void)n; }
48}
49
50#pragma clang module import a
51void use3() {
52 (void)n;
53 (void)::n;
54 (void)b::n;
55 (void)c::n;
56}
57namespace b {
58 void use3_in_b() { (void)n; }
59}
60namespace c {
61 void use3_in_c() { (void)n; }
62}