summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Index/index-templates.cpp6
-rw-r--r--clang/test/Modules/cxx-templates.cpp10
-rw-r--r--clang/test/SemaTemplate/temp_arg_template.cpp6
-rw-r--r--clang/test/SemaTemplate/temp_arg_template_cxx1z.cpp29
4 files changed, 34 insertions, 17 deletions
diff --git a/clang/test/Index/index-templates.cpp b/clang/test/Index/index-templates.cpp
index 79b9c181eca..966cc4f5ea7 100644
--- a/clang/test/Index/index-templates.cpp
+++ b/clang/test/Index/index-templates.cpp
@@ -49,9 +49,9 @@ template class vector<int*>;
struct Z4 {
template<typename T> T getAs();
};
-
+template<typename T, T> struct value { };
void template_exprs() {
- f<Unsigned, OneDimension, array>(array<Unsigned, OneDimension>());
+ f<Unsigned, OneDimension, value>(value<Unsigned, OneDimension>());
Z4().getAs<Unsigned>();
}
@@ -173,7 +173,7 @@ using alias = T;
// CHECK-LOAD: index-templates.cpp:54:3: DeclRefExpr=f:4:6 RefName=[54:3 - 54:4] RefName=[54:4 - 54:35] Extent=[54:3 - 54:35]
// CHECK-LOAD: index-templates.cpp:54:5: TypeRef=Unsigned:42:18 Extent=[54:5 - 54:13]
// CHECK-LOAD: index-templates.cpp:54:15: DeclRefExpr=OneDimension:35:16 Extent=[54:15 - 54:27]
-// CHECK-LOAD: index-templates.cpp:54:29: TemplateRef=array:37:8 Extent=[54:29 - 54:34]
+// CHECK-LOAD: index-templates.cpp:54:29: TemplateRef=value:52:32 Extent=[54:29 - 54:34]
// CHECK-LOAD: index-templates.cpp:55:8: MemberRefExpr=getAs:50:26 SingleRefName=[55:8 - 55:13] RefName=[55:8 - 55:13] Extent=[55:3 - 55:23]
// CHECK-LOAD: index-templates.cpp:55:3: CallExpr=Z4:49:8 Extent=[55:3 - 55:7]
// CHECK-LOAD: index-templates.cpp:55:14: TypeRef=Unsigned:42:18 Extent=[55:14 - 55:22]
diff --git a/clang/test/Modules/cxx-templates.cpp b/clang/test/Modules/cxx-templates.cpp
index 401b7704900..59e9136bd14 100644
--- a/clang/test/Modules/cxx-templates.cpp
+++ b/clang/test/Modules/cxx-templates.cpp
@@ -49,14 +49,8 @@ void g() {
// expected-note@Inputs/cxx-templates-a.h:11 {{candidate}}
// expected-note@Inputs/cxx-templates-b.h:11 {{candidate}}
- // FIXME: This should be valid, but we incorrectly match the template template
- // argument against both template template parameters.
- template_param_kinds_3<Tmpl_T_T_A>(); // expected-error {{ambiguous}}
- // expected-note@Inputs/cxx-templates-a.h:12 {{candidate}}
- // expected-note@Inputs/cxx-templates-b.h:12 {{candidate}}
- template_param_kinds_3<Tmpl_T_T_B>(); // expected-error {{ambiguous}}
- // expected-note@Inputs/cxx-templates-a.h:12 {{candidate}}
- // expected-note@Inputs/cxx-templates-b.h:12 {{candidate}}
+ template_param_kinds_3<Tmpl_T_T_A>();
+ template_param_kinds_3<Tmpl_T_T_B>();
// Trigger the instantiation of a template in 'a' that uses a type defined in
// 'common'. That type is not visible here.
diff --git a/clang/test/SemaTemplate/temp_arg_template.cpp b/clang/test/SemaTemplate/temp_arg_template.cpp
index 67cde53c928..b0df9149c6e 100644
--- a/clang/test/SemaTemplate/temp_arg_template.cpp
+++ b/clang/test/SemaTemplate/temp_arg_template.cpp
@@ -100,3 +100,9 @@ struct S : public template_tuple<identity, identity> {
void foo() {
f7<identity>();
}
+
+namespace CheckDependentNonTypeParamTypes {
+ template<template<typename T, typename U, T v> class> struct A {}; // expected-note {{previous}}
+ template<typename T, typename U, U v> struct B {}; // expected-note {{different type}}
+ A<B> ab; // expected-error {{different template parameters}}
+}
diff --git a/clang/test/SemaTemplate/temp_arg_template_cxx1z.cpp b/clang/test/SemaTemplate/temp_arg_template_cxx1z.cpp
index b6b283b53c6..aa517c32859 100644
--- a/clang/test/SemaTemplate/temp_arg_template_cxx1z.cpp
+++ b/clang/test/SemaTemplate/temp_arg_template_cxx1z.cpp
@@ -70,30 +70,47 @@ namespace Auto {
template<template<int*> typename T> struct TIntPtr {};
template<template<auto> typename T> struct TAuto {};
template<template<auto*> typename T> struct TAutoPtr {};
+ template<template<decltype(auto)> typename T> struct TDecltypeAuto {};
template<auto> struct Auto;
template<auto*> struct AutoPtr;
+ template<decltype(auto)> struct DecltypeAuto;
template<int> struct Int;
template<int*> struct IntPtr;
TInt<Auto> ia;
- TInt<AutoPtr> iap; // FIXME: ill-formed
+ TInt<AutoPtr> iap; // expected-error {{different template parameters}}
+ TInt<DecltypeAuto> ida; // FIXME expected-error {{different template parameters}}
TInt<Int> ii;
TInt<IntPtr> iip; // expected-error {{different template parameters}}
TIntPtr<Auto> ipa;
TIntPtr<AutoPtr> ipap;
+ TIntPtr<DecltypeAuto> ipda; // FIXME expected-error {{different template parameters}}
TIntPtr<Int> ipi; // expected-error {{different template parameters}}
TIntPtr<IntPtr> ipip;
TAuto<Auto> aa;
- TAuto<AutoPtr> aap; // FIXME: ill-formed
- TAuto<Int> ai; // FIXME: ill-formed
- TAuto<IntPtr> aip; // FIXME: ill-formed
+ TAuto<AutoPtr> aap; // expected-error {{different template parameters}}
+ TAuto<Int> ai; // expected-error {{different template parameters}}
+ TAuto<IntPtr> aip; // expected-error {{different template parameters}}
TAutoPtr<Auto> apa;
TAutoPtr<AutoPtr> apap;
- TAutoPtr<Int> api; // FIXME: ill-formed
- TAutoPtr<IntPtr> apip; // FIXME: ill-formed
+ TAutoPtr<Int> api; // expected-error {{different template parameters}}
+ TAutoPtr<IntPtr> apip; // expected-error {{different template parameters}}
+
+ TDecltypeAuto<DecltypeAuto> dada;
+ TDecltypeAuto<Int> dai; // expected-error {{different template parameters}}
+ TDecltypeAuto<IntPtr> daip; // expected-error {{different template parameters}}
+
+ // FIXME: It's completely unclear what should happen here. A case can be made
+ // that 'auto' is more specialized, because it's always a prvalue, whereas
+ // 'decltype(auto)' could have any value category. Under that interpretation,
+ // we get the following results entirely backwards:
+ TAuto<DecltypeAuto> ada; // expected-error {{different template parameters}}
+ TAutoPtr<DecltypeAuto> apda; // expected-error {{different template parameters}}
+ TDecltypeAuto<Auto> daa;
+ TDecltypeAuto<AutoPtr> daa; // expected-error {{different template parameters}}
int n;
template<auto A, decltype(A) B = &n> struct SubstFailure;
OpenPOWER on IntegriCloud