From 130cc445e46836b28defdce03b1adfdb16ddcf41 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 21 Feb 2017 23:49:18 +0000 Subject: Fix deduction of type of pack-expanded non-type template parameter. We need to look through the PackExpansionType in the parameter type when deducing, and we need to consider the possibility of deducing arguments for packs that are not lexically mentioned in the pattern (but are nonetheless deducible) when figuring out which packs are covered by a pack deduction scope. llvm-svn: 295790 --- .../SemaCXX/cxx1z-class-template-argument-deduction.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp') diff --git a/clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp b/clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp index 750a0892917..5eee34e8097 100644 --- a/clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp +++ b/clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp @@ -203,13 +203,19 @@ namespace transform_params { }; B b({1, 2, 3}, "foo", {'x', 'y', 'z', 'w'}); // ok + // This should be accepted once -std=c++1z implies + // -frelaxed-template-template-args. Without that, a template template + // parameter 'template typename' cannot bind to a template + // template argument 'template typename'. template struct C { // expected-note {{candidate}} template typename X> - C(X); // expected-note {{substitution failure [with T = <>, V = <0, 1, 2>]}} + C(X); // expected-note {{substitution failure [with T = , V = <0, 1, 2>]}} }; template struct Y {}; - // FIXME: This incorrectly deduces T = <>, rather than deducing - // T = from the types of the elements of V. - // (This failure is not related to class template argument deduction.) C c(Y<0, 1, 2>{}); // expected-error {{no viable constructor or deduction guide}} + + template struct D { + template D(Y); + }; + D d(Y<0, 1, 2>{}); } -- cgit v1.2.3