On 11/20/2011 07:22 PM, Jason Merrill wrote:
Hmm, actually, that still shouldn't have produced an error, it should just SFINAE. Another bug to fix...
Thus. Tested x86_64-pc-linux-gnu, applying to trunk.
commit 9c48487dc4ba1a0fd3235b03a00930379a8e7620 Author: Jason Merrill <ja...@redhat.com> Date: Sun Nov 20 19:33:21 2011 -0500 * pt.c (tsubst_pack_expansion): Fix SFINAE. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index f0ee0c5..2ba26b2 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9350,7 +9350,9 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain, len = my_len; else if (len != my_len) { - if (TREE_CODE (t) == TYPE_PACK_EXPANSION) + if (!(complain & tf_error)) + /* Fail quietly. */; + else if (TREE_CODE (t) == TYPE_PACK_EXPANSION) error ("mismatched argument pack lengths while expanding " "%<%T%>", pattern); diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae30.C b/gcc/testsuite/g++.dg/cpp0x/sfinae30.C new file mode 100644 index 0000000..6fcf5f7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae30.C @@ -0,0 +1,25 @@ +// { dg-do compile { target c++11 } } + +template <class... T> struct tuple; +template <class T> struct tuple<T> { T t; }; + +template <class T, class U> struct pair; +template<> struct pair<int,double> { }; + +template <class... Ts> +struct A +{ + template <class... Us, + class V = tuple<pair<Ts,Us>...> > + static void f(Us...) + { + V v; + } + template <class U> + static void f(bool); +}; + +int main() +{ + A<int,float>::f<double>(1.0); +}