diff options
author | Richard Smith <richard@metafoo.co.uk> | 2020-01-06 17:16:29 -0800 |
---|---|---|
committer | Richard Smith <richard@metafoo.co.uk> | 2020-01-06 17:24:29 -0800 |
commit | 907cefe721437fa8950c1b6c1c028038b175f921 (patch) | |
tree | 681bd08696a5f318722817b83694f9827ec2ee77 /clang/test/SemaTemplate/alias-templates.cpp | |
parent | e93b1ffc8490d943690726370a0e9277fd78520d (diff) | |
download | bcm5719-llvm-907cefe721437fa8950c1b6c1c028038b175f921.tar.gz bcm5719-llvm-907cefe721437fa8950c1b6c1c028038b175f921.zip |
Always deduce the lengths of contained parameter packs when deducing a
pack expansion.
Previously, if all parameter / argument pairs for a pack expansion
deduction were non-deduced contexts, we would not deduce the arity of
the pack, and could end up deducing a different arity (leading to
failures during substitution) or defaulting to an arity of 0 (leading to
bad diagnostics about passing the wrong number of arguments to a
variadic function). Instead, we now always deduce the arity for all
involved packs any time we deduce a pack expansion.
This will result in less substitution happening in some cases, which
could avoid non-SFINAEable errors, and should generally improve the
quality of diagnostics when passing initializer lists to variadic
functions.
Diffstat (limited to 'clang/test/SemaTemplate/alias-templates.cpp')
-rw-r--r-- | clang/test/SemaTemplate/alias-templates.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/clang/test/SemaTemplate/alias-templates.cpp b/clang/test/SemaTemplate/alias-templates.cpp index 240a6eeff2e..80678bf2298 100644 --- a/clang/test/SemaTemplate/alias-templates.cpp +++ b/clang/test/SemaTemplate/alias-templates.cpp @@ -77,14 +77,12 @@ namespace PR11848 { return i + f1<Ts...>(is...); } - // FIXME: This note is technically correct, but could be better. We - // should really say that we couldn't infer template argument 'Ts'. template<typename ...Ts> - void f2(U<Ts> ...is) { } // expected-note {{requires 0 arguments, but 1 was provided}} + void f2(U<Ts> ...is) { } // expected-note {{deduced incomplete pack <(no value)> for template parameter 'Ts'}} template<typename...> struct type_tuple {}; template<typename ...Ts> - void f3(type_tuple<Ts...>, U<Ts> ...is) {} // expected-note {{requires 4 arguments, but 3 were provided}} + void f3(type_tuple<Ts...>, U<Ts> ...is) {} // expected-note {{deduced packs of different lengths for parameter 'Ts' (<void, void, void> vs. <(no value), (no value)>)}} void g() { f1(U<void>()); // expected-error {{no match}} |