Richard Smith | 86dfc1e | 2015-06-18 22:07:00 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
| 2 | // RUN: mkdir %t |
| 3 | // RUN: echo 'namespace N { enum E { A }; }' > %t/a.h |
| 4 | // RUN: echo '#include "a.h"' > %t/b.h |
| 5 | // RUN: touch %t/x.h |
| 6 | // RUN: echo 'module B { module b { header "b.h" } module x { header "x.h" } }' > %t/b.modulemap |
Richard Smith | edcc92a | 2015-11-05 01:30:19 +0000 | [diff] [blame] | 7 | // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x c++ -fmodule-map-file=%t/b.modulemap %s -I%t -verify -fmodules-local-submodule-visibility |
| 8 | // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x c++ -fmodule-map-file=%t/b.modulemap %s -I%t -verify -fmodules-local-submodule-visibility -DMERGE_LATE |
| 9 | |
| 10 | #ifndef MERGE_LATE |
Richard Smith | 86dfc1e | 2015-06-18 22:07:00 +0000 | [diff] [blame] | 11 | // expected-no-diagnostics |
| 12 | #include "a.h" |
Richard Smith | edcc92a | 2015-11-05 01:30:19 +0000 | [diff] [blame] | 13 | #endif |
| 14 | |
Richard Smith | 86dfc1e | 2015-06-18 22:07:00 +0000 | [diff] [blame] | 15 | #include "x.h" |
Richard Smith | edcc92a | 2015-11-05 01:30:19 +0000 | [diff] [blame] | 16 | |
| 17 | #ifdef MERGE_LATE |
| 18 | namespace N { |
| 19 | // FIXME: Should we accept this and reject the usage below due to ambiguity instead? |
| 20 | enum { A } a; // expected-error {{redefinition of enumerator 'A'}} |
| 21 | // expected-note@a.h:1 {{here}} (from module B.b) |
| 22 | } |
| 23 | #include "a.h" |
| 24 | #endif |
| 25 | |
Richard Smith | 86dfc1e | 2015-06-18 22:07:00 +0000 | [diff] [blame] | 26 | N::E e = N::A; |