From 43a833bec47b9eb43cd57ef61256b1a287ee32c2 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 9 Jan 2017 23:54:33 +0000 Subject: Check that template template arguments match template template parameters properly even when a non-type template parameter has a dependent type. Previously, if a non-type template parameter was dependent, but not dependent on an outer level of template parameter, we would not match the type of the parameter. Under [temp.arg.template], we are supposed to check that the types are equivalent, which means checking for syntactic equivalence in the dependent case. This also fixes some accepts-invalids when passing templates with auto-typed non-type template parameters as template template arguments. llvm-svn: 291512 --- .../test/SemaTemplate/temp_arg_template_cxx1z.cpp | 29 +++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'clang/test/SemaTemplate/temp_arg_template_cxx1z.cpp') 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 typename T> struct TIntPtr {}; template typename T> struct TAuto {}; template typename T> struct TAutoPtr {}; + template typename T> struct TDecltypeAuto {}; template struct Auto; template struct AutoPtr; + template struct DecltypeAuto; template struct Int; template struct IntPtr; TInt ia; - TInt iap; // FIXME: ill-formed + TInt iap; // expected-error {{different template parameters}} + TInt ida; // FIXME expected-error {{different template parameters}} TInt ii; TInt iip; // expected-error {{different template parameters}} TIntPtr ipa; TIntPtr ipap; + TIntPtr ipda; // FIXME expected-error {{different template parameters}} TIntPtr ipi; // expected-error {{different template parameters}} TIntPtr ipip; TAuto aa; - TAuto aap; // FIXME: ill-formed - TAuto ai; // FIXME: ill-formed - TAuto aip; // FIXME: ill-formed + TAuto aap; // expected-error {{different template parameters}} + TAuto ai; // expected-error {{different template parameters}} + TAuto aip; // expected-error {{different template parameters}} TAutoPtr apa; TAutoPtr apap; - TAutoPtr api; // FIXME: ill-formed - TAutoPtr apip; // FIXME: ill-formed + TAutoPtr api; // expected-error {{different template parameters}} + TAutoPtr apip; // expected-error {{different template parameters}} + + TDecltypeAuto dada; + TDecltypeAuto dai; // expected-error {{different template parameters}} + TDecltypeAuto 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 ada; // expected-error {{different template parameters}} + TAutoPtr apda; // expected-error {{different template parameters}} + TDecltypeAuto daa; + TDecltypeAuto daa; // expected-error {{different template parameters}} int n; template struct SubstFailure; -- cgit v1.2.3