diff options
Diffstat (limited to 'test/Modules/tag-injection.cpp')
-rw-r--r-- | test/Modules/tag-injection.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/Modules/tag-injection.cpp b/test/Modules/tag-injection.cpp new file mode 100644 index 0000000..75c8b5f --- /dev/null +++ b/test/Modules/tag-injection.cpp @@ -0,0 +1,22 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: touch %t/a.h +// RUN: echo 'struct X {};' > %t/b.h +// RUN: echo 'module X { module a { header "a.h" } module b { header "b.h" } }' > %t/x.modulemap +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x c++ -fmodule-map-file=%t/x.modulemap %s -I%t -verify -fmodules-local-submodule-visibility -std=c++11 + +#include "a.h" + +struct A { + // This use of 'struct X' makes the declaration (but not definition) of X visible. + virtual void f(struct X *p); +}; + +namespace N { + struct B : A { + void f(struct X *q) override; + }; +} + +X x; // expected-error {{definition of 'X' must be imported from module 'X.b' before it is required}} +// expected-note@b.h:1 {{here}} |