From 7c368fb23cc92a3406e181ae361ebce3f5b9ab22 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 13 Jan 2015 16:04:35 -0500 Subject: [PATCH] re PR c++/64514 (Error in template instantiation in GCC 4.9, works fine in GCC 4.8) PR c++/64514 * pt.c (coerce_template_parameter_pack): Return NULL for a zero-length fixed parameter pack with a pack expansion arg. From-SVN: r219558 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/pt.c | 3 +++ gcc/testsuite/g++.dg/cpp0x/variadic165.C | 17 +++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic165.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0e94fe136a4..668b13bc1be 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2015-01-13 Jason Merrill + PR c++/64514 + * pt.c (coerce_template_parameter_pack): Return NULL for a + zero-length fixed parameter pack with a pack expansion arg. + PR c++/64520 * pt.c (unify): Don't try to deduce to std::initializer_list. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 3ac93db948a..55871e5b6db 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -6825,6 +6825,9 @@ coerce_template_parameter_pack (tree parms, if (invalid_nontype_parm_type_p (t, complain)) return error_mark_node; } + /* We don't know how many args we have yet, just + use the unconverted ones for now. */ + return NULL_TREE; } packed_args = make_tree_vec (TREE_VEC_LENGTH (packed_parms)); diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic165.C b/gcc/testsuite/g++.dg/cpp0x/variadic165.C new file mode 100644 index 00000000000..862931f6619 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic165.C @@ -0,0 +1,17 @@ +// PR c++/64514 +// { dg-do compile { target c++11 } } + +template +struct Functor +{ + template + struct Inner + {}; +}; + +template struct Functor<>::Inner<>; + +int main() +{ + +} -- 2.30.2