Compile the attached preprocessed file with "g++ -std=c++0x -c -x c++ bug.i". The compiler ICEs. Seems to be a problem with template varargs. This is with the latest g++, built from svn on 10/30/2007, with some patches from Doug Gregor for various problems.
Created attachment 14446 [details] preprocessed source code
I can duplicate this locally. Here's a smaller test case: template<typename T> struct uncvref { typedef T type; }; template<typename... Args> struct args { static const int size = sizeof...(Args); }; template<typename G, typename E, typename S, typename V, long GN = G::size, long EN = E::size> struct apply_args; template<typename... G, typename... E, typename S, typename V, long N> struct apply_args<args<G...>, args<E...>, S, V, N, N> { typedef args< typename G::template apply<typename uncvref<E>::type, S, V>::type... > type; }; struct or_ { template<typename E, typename S, typename V> struct apply { typedef typename E::type type; }; }; template<typename T> struct identity { typedef T type; }; apply_args<args<or_>, args<identity<int>>, float, double> a1; I'm working on a fix now.
This tiny patch should fix the problem. We weren't digging into TYPENAME_TYPEs deep enough to find all of the parameter packs. The patch fixes both the original test case and the reduced one. However, I can't test it in isolation at the moment. Index: pt.c =================================================================== --- pt.c (revision 129773) +++ pt.c (working copy) @@ -2505,6 +2505,12 @@ find_parameter_packs_r (tree *tp, int *w *walk_subtrees = 0; return NULL_TREE; + case TYPENAME_TYPE: + cp_walk_tree (&TYPENAME_TYPE_FULLNAME (t), &find_parameter_packs_r, + ppd, ppd->visited); + *walk_subtrees = 0; + return NULL_TREE; + case TYPE_PACK_EXPANSION: case EXPR_PACK_EXPANSION: *walk_subtrees = 0;
Subject: Bug 33955 Author: dgregor Date: Fri Nov 2 03:26:46 2007 New Revision: 129843 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129843 Log: 2007-11-01 Douglas Gregor <doug.gregor@gmail.com> PR c++/33955 * pt.c (find_parameter_packs_r): Handle TYPENAME_TYPE. 2007-11-01 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/cpp0x/pr33955.C: New. Added: trunk/gcc/testsuite/g++.dg/cpp0x/pr33955.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog
Fixed.