aboutsummaryrefslogtreecommitdiff
path: root/test/Modules/cxx-templates.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Modules/cxx-templates.cpp')
-rw-r--r--test/Modules/cxx-templates.cpp46
1 files changed, 42 insertions, 4 deletions
diff --git a/test/Modules/cxx-templates.cpp b/test/Modules/cxx-templates.cpp
index cbe9f3508951..d9c8a8c27d0d 100644
--- a/test/Modules/cxx-templates.cpp
+++ b/test/Modules/cxx-templates.cpp
@@ -1,12 +1,18 @@
// RUN: rm -rf %t
-// 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-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-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
+// RUN: %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 -DEARLY_IMPORT
+
+#ifdef EARLY_IMPORT
+#include "cxx-templates-textual.h"
+#endif
@import cxx_templates_a;
@import cxx_templates_b;
@import cxx_templates_c;
+@import cxx_templates_d;
@import cxx_templates_common;
template<typename, char> struct Tmpl_T_C {};
@@ -22,15 +28,21 @@ void g() {
f<double>(1.0);
f<int>();
f(); // expected-error {{no matching function}}
+#ifdef EARLY_IMPORT
+ // FIXME: The textual inclusion above shouldn't affect this!
+ // expected-note@Inputs/cxx-templates-a.h:3 {{couldn't infer template argument}}
+ // expected-note@Inputs/cxx-templates-a.h:4 {{requires 1 argument}}
+#else
// expected-note@Inputs/cxx-templates-b.h:3 {{couldn't infer template argument}}
// expected-note@Inputs/cxx-templates-b.h:4 {{requires single argument}}
+#endif
N::f(0);
N::f<double>(1.0);
N::f<int>();
N::f(); // expected-error {{no matching function}}
- // expected-note@Inputs/cxx-templates-a.h:6 {{couldn't infer template argument}}
- // expected-note@Inputs/cxx-templates-a.h:7 {{requires 1 argument}}
+ // expected-note@Inputs/cxx-templates-b.h:6 {{couldn't infer template argument}}
+ // expected-note@Inputs/cxx-templates-b.h:7 {{requires single argument}}
template_param_kinds_1<0>(); // ok, from cxx-templates-a.h
template_param_kinds_1<int>(); // ok, from cxx-templates-b.h
@@ -105,11 +117,22 @@ void g() {
int &p = WithPartialSpecializationUse().f();
int &q = WithExplicitSpecializationUse().inner_template<int>();
+ int *r = PartiallyInstantiatePartialSpec<int*>::bar();
+
+ (void)&WithImplicitSpecialMembers<int>::n;
+
+ MergeClassTemplateSpecializations_string s;
+
+ extern TestInjectedClassName::A *use_a;
+ extern TestInjectedClassName::C *use_c;
+ TestInjectedClassName::UseD();
}
static_assert(Outer<int>::Inner<int>::f() == 1, "");
static_assert(Outer<int>::Inner<int>::g() == 2, "");
+#ifndef EARLY_IMPORT
+// FIXME: The textual inclusion above shouldn't cause this to fail!
static_assert(MergeTemplateDefinitions<int>::f() == 1, "");
static_assert(MergeTemplateDefinitions<int>::g() == 2, "");
@@ -123,6 +146,21 @@ MergeSpecializations<int[]>::partially_specialized_in_c spec_in_c_1;
MergeSpecializations<char>::explicitly_specialized_in_a spec_in_a_2;
MergeSpecializations<double>::explicitly_specialized_in_b spec_in_b_2;
MergeSpecializations<bool>::explicitly_specialized_in_c spec_in_c_2;
+#endif
+
+MergeAnonUnionMember<> maum_main;
+typedef DontWalkPreviousDeclAfterMerging<int> dwpdam_typedef_2;
+dwpdam_typedef::type dwpdam_typedef_use;
+DontWalkPreviousDeclAfterMerging<int>::Inner::type dwpdam;
+
+using AliasTemplateMergingTest = WithAliasTemplate<int>::X<char>;
+
+int AnonymousDeclsMergingTest(WithAnonymousDecls<int> WAD, WithAnonymousDecls<char> WADC) {
+ return InstantiateWithAnonymousDeclsA(WAD) +
+ InstantiateWithAnonymousDeclsB(WAD) +
+ InstantiateWithAnonymousDeclsB2(WADC) +
+ InstantiateWithAnonymousDeclsD(WADC);
+}
@import cxx_templates_common;