diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-01-06 03:52:10 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-01-06 03:52:10 +0000 |
| commit | 26dfbace823d7febcf2ce1fc57e5bb90e1276b61 (patch) | |
| tree | a1b150855156f7f22565575fc6df78d16c3b0d29 /clang/test/Modules | |
| parent | 3ec882feed9c5293075bc7a4f286ddccc977198a (diff) | |
| download | bcm5719-llvm-26dfbace823d7febcf2ce1fc57e5bb90e1276b61.tar.gz bcm5719-llvm-26dfbace823d7febcf2ce1fc57e5bb90e1276b61.zip | |
[modules] When a tag type that was imported from a module is referenced via an
elaborated-type-specifier, create a declaration of it to track that the current
module makes it visible too.
llvm-svn: 256907
Diffstat (limited to 'clang/test/Modules')
| -rw-r--r-- | clang/test/Modules/tag-injection.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/test/Modules/tag-injection.cpp b/clang/test/Modules/tag-injection.cpp new file mode 100644 index 00000000000..75c8b5fecdb --- /dev/null +++ b/clang/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}} |

