diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-05-07 02:25:43 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-05-07 02:25:43 +0000 |
commit | 3d23c42029a8675f388c996fc7e7c1aff5e85f43 (patch) | |
tree | 7867dc23443f2c78d542641d80c731461d228975 /clang/test/Modules/cxx-templates.cpp | |
parent | cf27e1b996f290c4ae186fd9060bf5b36302b3ec (diff) | |
download | bcm5719-llvm-3d23c42029a8675f388c996fc7e7c1aff5e85f43.tar.gz bcm5719-llvm-3d23c42029a8675f388c996fc7e7c1aff5e85f43.zip |
If an instantiation of a template is required to be a complete type, check
whether the definition of the template is visible rather than checking whether
the instantiated definition happens to be in an imported module.
llvm-svn: 208150
Diffstat (limited to 'clang/test/Modules/cxx-templates.cpp')
-rw-r--r-- | clang/test/Modules/cxx-templates.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/clang/test/Modules/cxx-templates.cpp b/clang/test/Modules/cxx-templates.cpp index 82ecca31b56..ab65e3dd2d0 100644 --- a/clang/test/Modules/cxx-templates.cpp +++ b/clang/test/Modules/cxx-templates.cpp @@ -1,8 +1,8 @@ // RUN: rm -rf %t -// RUN: not %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump -ast-dump-lookups | FileCheck %s --check-prefix=CHECK-GLOBAL -// RUN: not %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump -ast-dump-lookups -ast-dump-filter N | FileCheck %s --check-prefix=CHECK-NAMESPACE-N -// RUN: not %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump | FileCheck %s --check-prefix=CHECK-DUMP -// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 +// RUN: not %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump -ast-dump-lookups | FileCheck %s --check-prefix=CHECK-GLOBAL +// RUN: not %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump -ast-dump-lookups -ast-dump-filter N | FileCheck %s --check-prefix=CHECK-NAMESPACE-N +// RUN: not %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump | FileCheck %s --check-prefix=CHECK-DUMP +// RUN: %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 @import cxx_templates_a; @import cxx_templates_b; @@ -71,8 +71,15 @@ void g() { // Trigger the instantiation of a template in 'a' that uses a type defined in // 'b_impl'. That type is not visible here, nor in 'a'. This fails; there is // no reason why DefinedInBImpl should be visible here. + // + // We turn off error recovery for modules in this test (so we don't get an + // implicit import of cxx_templates_b_impl), and that results in us producing + // a big spew of errors here. + // // expected-error@Inputs/cxx-templates-a.h:19 {{definition of 'DefinedInBImpl' must be imported}} - // expected-note@Inputs/cxx-templates-b-impl.h:1 {{definition is here}} + // expected-note@Inputs/cxx-templates-b-impl.h:1 +{{definition is here}} + // expected-error@Inputs/cxx-templates-a.h:19 +{{}} + // expected-error@Inputs/cxx-templates-a.h:20 +{{}} PerformDelayedLookup(defined_in_b_impl); // expected-note {{in instantiation of}} merge_templates_a = merge_templates_b; // ok, same type @@ -89,6 +96,12 @@ void g() { static_assert(enum_c_from_a == enum_c_from_b, ""); CommonTemplate<int> cti; CommonTemplate<int>::E eee = CommonTemplate<int>::c; + + TemplateInstantiationVisibility<char[1]> tiv1; + TemplateInstantiationVisibility<char[2]> tiv2; + TemplateInstantiationVisibility<char[3]> tiv3; // expected-error {{must be imported from module 'cxx_templates_b_impl'}} + // expected-note@cxx-templates-b-impl.h:10 {{previous definition is here}} + TemplateInstantiationVisibility<char[4]> tiv4; } RedeclaredAsFriend<int> raf1; |