xref: /llvm-project/clang/test/Modules/merge-enumerators.cpp (revision 97135cc94a8fcc1ec9b04e4db4ef08c18081b8be)
186dfc1eaSRichard Smith // RUN: rm -rf %t
286dfc1eaSRichard Smith // RUN: mkdir %t
386dfc1eaSRichard Smith // RUN: echo 'namespace N { enum E { A }; }' > %t/a.h
486dfc1eaSRichard Smith // RUN: echo '#include "a.h"' > %t/b.h
586dfc1eaSRichard Smith // RUN: touch %t/x.h
686dfc1eaSRichard Smith // RUN: echo 'module B { module b { header "b.h" } module x { header "x.h" } }' > %t/b.modulemap
7edcc92a4SRichard Smith // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x c++ -fmodule-map-file=%t/b.modulemap %s -I%t -verify -fmodules-local-submodule-visibility
8edcc92a4SRichard Smith // 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
9edcc92a4SRichard Smith 
10edcc92a4SRichard Smith #ifndef MERGE_LATE
1186dfc1eaSRichard Smith // expected-no-diagnostics
1286dfc1eaSRichard Smith #include "a.h"
13edcc92a4SRichard Smith #endif
14edcc92a4SRichard Smith 
1586dfc1eaSRichard Smith #include "x.h"
16edcc92a4SRichard Smith 
17edcc92a4SRichard Smith #ifdef MERGE_LATE
18edcc92a4SRichard Smith namespace N {
19*97135cc9SRichard Smith   enum { A } a; // expected-note {{candidate}}
20*97135cc9SRichard Smith   // expected-note@a.h:1 {{candidate}} (from module B.b)
21edcc92a4SRichard Smith }
22edcc92a4SRichard Smith #include "a.h"
23edcc92a4SRichard Smith #endif
24edcc92a4SRichard Smith 
2586dfc1eaSRichard Smith N::E e = N::A;
26*97135cc9SRichard Smith #ifdef MERGE_LATE
27*97135cc9SRichard Smith // expected-error@-2 {{ambiguous}}
28*97135cc9SRichard Smith #endif
29