diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-05-18 19:34:55 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-05-18 19:34:55 +0000 |
commit | f4f62003f452ff49894fc9fa44b93d7a1b1a8b19 (patch) | |
tree | dffe40a25585b81d2ae63318482b62ba632cfb65 /clang/test/Modules/extern_cxx.cpp | |
parent | af3b3256270ca41eb0ab5e8d0af1ba2e0d698689 (diff) | |
download | bcm5719-llvm-f4f62003f452ff49894fc9fa44b93d7a1b1a8b19.tar.gz bcm5719-llvm-f4f62003f452ff49894fc9fa44b93d7a1b1a8b19.zip |
When we enter a module within a linkage specification, switch the linkage
specification and the TU to the new module.
This is necessary to get the module ownership correct for entities that we
temporarily hang off the TranslationUnitDecl, such as template parameters and
function parameters.
llvm-svn: 303373
Diffstat (limited to 'clang/test/Modules/extern_cxx.cpp')
-rw-r--r-- | clang/test/Modules/extern_cxx.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/Modules/extern_cxx.cpp b/clang/test/Modules/extern_cxx.cpp new file mode 100644 index 00000000000..97ec726de23 --- /dev/null +++ b/clang/test/Modules/extern_cxx.cpp @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -x c++-module-map -fmodule-name=A -verify %s -fmodules-local-submodule-visibility +module A { module B {} module C {} } + +#pragma clang module contents + +#pragma clang module begin A.B +extern "C++" { + #pragma clang module begin A.C + template<typename T> void f(T t); + #pragma clang module end + + void g() { f(0); } // ok +} + +extern "C++" { + #pragma clang module begin A.C + } // expected-error {{extraneous closing brace}} + #pragma clang module end + + #pragma clang module begin A.C + extern "C++" { // expected-note {{to match this '{'}} + #pragma clang module end // expected-error {{expected '}' at end of module}} +} + +#pragma clang module end |