diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-02-21 23:49:18 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-02-21 23:49:18 +0000 |
| commit | 130cc445e46836b28defdce03b1adfdb16ddcf41 (patch) | |
| tree | d21290fd46337cb99f9829ca4d019ca4d277b8e6 /clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp | |
| parent | 9417505f7db57d5413b9974b5484291466ba42a3 (diff) | |
| download | bcm5719-llvm-130cc445e46836b28defdce03b1adfdb16ddcf41.tar.gz bcm5719-llvm-130cc445e46836b28defdce03b1adfdb16ddcf41.zip | |
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
Diffstat (limited to 'clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp')
| -rw-r--r-- | clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
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<int, int, int> typename' cannot bind to a template + // template argument 'template<int...> typename'. template<typename ...T> struct C { // expected-note {{candidate}} template<T ...V, template<T...> typename X> - C(X<V...>); // expected-note {{substitution failure [with T = <>, V = <0, 1, 2>]}} + C(X<V...>); // expected-note {{substitution failure [with T = <int, int, int>, V = <0, 1, 2>]}} }; template<int...> struct Y {}; - // FIXME: This incorrectly deduces T = <>, rather than deducing - // T = <int, int, int> 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<typename ...T> struct D { + template<T ...V> D(Y<V...>); + }; + D d(Y<0, 1, 2>{}); } |

