blob: 5267ac658b8be1a913a2e81d860aa375cc49fd8c [file] [log] [blame]
Richard Smith86dfc1e2015-06-18 22:07:00 +00001// 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 Smithedcc92a2015-11-05 01:30:19 +00007// 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 Smith86dfc1e2015-06-18 22:07:00 +000011// expected-no-diagnostics
12#include "a.h"
Richard Smithedcc92a2015-11-05 01:30:19 +000013#endif
14
Richard Smith86dfc1e2015-06-18 22:07:00 +000015#include "x.h"
Richard Smithedcc92a2015-11-05 01:30:19 +000016
17#ifdef MERGE_LATE
18namespace 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 Smith86dfc1e2015-06-18 22:07:00 +000026N::E e = N::A;