GCC Bugzilla – Attachment 14255 Details for
Bug 32565
[4.3 regression] ICE with specialization of variadic template
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
gcc43-pr32565.patch
gcc43-pr32565.patch (text/plain), 3.58 KB, created by
Jakub Jelinek
on 2007-09-27 12:12:47 UTC
(
hide
)
Description:
gcc43-pr32565.patch
Filename:
MIME Type:
Creator:
Jakub Jelinek
Created:
2007-09-27 12:12:47 UTC
Size:
3.58 KB
patch
obsolete
>--- gcc/cp/cp/pt.c.jj 2007-09-27 13:04:12.000000000 +0200 >+++ gcc/cp/cp/pt.c 2007-09-27 13:52:20.000000000 +0200 >@@ -12515,7 +12515,7 @@ unify (tree tparms, tree targs, tree par > tree argvec = INNERMOST_TEMPLATE_ARGS (TYPE_TI_ARGS (arg)); > tree argtmplvec > = DECL_INNERMOST_TEMPLATE_PARMS (TYPE_TI_TEMPLATE (arg)); >- int i; >+ int i, j; > > /* The resolution to DR150 makes clear that default > arguments for an N-argument may not be used to bind T >@@ -12557,11 +12557,55 @@ unify (tree tparms, tree targs, tree par > rather than the whole TREE_VEC since they can have > different number of elements. */ > >- for (i = 0; i < TREE_VEC_LENGTH (parmvec); ++i) >+ for (i = 0, j = 0; i < TREE_VEC_LENGTH (parmvec); ++i, ++j) > { >+ if (j >= TREE_VEC_LENGTH (argvec)) >+ return 1; >+ >+ if (ARGUMENT_PACK_P (TREE_VEC_ELT (parmvec, i)) >+ && !ARGUMENT_PACK_P (TREE_VEC_ELT (argvec, i))) >+ { >+ tree packed_parms >+ = ARGUMENT_PACK_ARGS (TREE_VEC_ELT (parmvec, i)); >+ int len = TREE_VEC_LENGTH (packed_parms); >+ int parm_variadic_p = 0; >+ int argslen = TREE_VEC_LENGTH (argvec) - j; >+ int k; >+ >+ /* Check if the parameters end in a pack, >+ making them variadic. */ >+ if (len > 0 >+ && PACK_EXPANSION_P (TREE_VEC_ELT (packed_parms, >+ len - 1))) >+ parm_variadic_p = 1; >+ >+ if (parm_variadic_p && i != TREE_VEC_LENGTH (parmvec) - 1) >+ return 1; >+ >+ /* If we don't have enough arguments to satisfy the >+ parameters, we can't unify. */ >+ if (argslen < (len - parm_variadic_p)) >+ return 1; >+ >+ /* Unify all of the parameters that precede the (optional) >+ pack expression. */ >+ for (k = 0; k < len - parm_variadic_p; k++) >+ if (unify (tparms, targs, TREE_VEC_ELT (packed_parms, k), >+ TREE_VEC_ELT (argvec, j + k), >+ UNIFY_ALLOW_NONE)) >+ return 1; >+ >+ j += k - 1; >+ >+ if (parm_variadic_p) >+ return 1; /* FIXME */ >+ >+ continue; >+ } >+ > if (unify (tparms, targs, > TREE_VEC_ELT (parmvec, i), >- TREE_VEC_ELT (argvec, i), >+ TREE_VEC_ELT (argvec, j), > UNIFY_ALLOW_NONE)) > return 1; > } >@@ -12980,6 +13024,8 @@ unify (tree tparms, tree targs, tree par > > case TYPE_ARGUMENT_PACK: > case NONTYPE_ARGUMENT_PACK: >+ if (TREE_CODE (parm) != TREE_CODE (arg)) >+ return 1; > { > tree packed_parms = ARGUMENT_PACK_ARGS (parm); > tree packed_args = ARGUMENT_PACK_ARGS (arg); >--- gcc/cp/testsuite/g++.dg/cpp0x/variadic79.C.jj 2007-09-27 14:03:06.000000000 +0200 >+++ gcc/cp/testsuite/g++.dg/cpp0x/variadic79.C 2007-09-27 14:02:01.000000000 +0200 >@@ -0,0 +1,26 @@ >+// PR c++/32565 >+// { dg-do compile } >+// { dg-options "-std=c++0x" } >+ >+template<typename...> struct A1; >+template<template<int...> class T> struct A1<T<0> > {}; >+template<typename...> struct A2; >+template<template<int...> class T> struct A2<T<0, 1> > {}; >+template<typename...> struct A3; >+template<template<int, int...> class T> struct A3<T<0, 1> > {}; >+template<typename...> struct A4; >+template<template<typename...> class T> struct A4<T<int> > {}; >+template<typename...> struct A5; >+template<template<typename...> class T> struct A5<T<int, long> > {}; >+template<typename...> struct A6; >+template<template<typename, typename...> class T> struct A6<T<int, long> > {}; >+template<int> struct B1 {}; >+template<int, int> struct B2 {}; >+template<typename> struct B3 {}; >+template<typename, typename> struct B4 {}; >+A1<B1<0> > a1; >+A2<B2<0, 1> > a2; >+A3<B2<0, 1> > a3; >+A4<B3<int> > a4; >+A5<B4<int, long> > a5; >+A6<B4<int, long> > a6;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 32565
: 14255