diff options
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r-- | gcc/cp/pt.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c9c25cd2..ab48c8f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14262,11 +14262,24 @@ type_unification_real (tree tparms, while (parms && parms != void_list_node && ia < nargs) { - if (TREE_CODE (TREE_VALUE (parms)) == TYPE_PACK_EXPANSION) - break; - parm = TREE_VALUE (parms); + + if (TREE_CODE (parm) == TYPE_PACK_EXPANSION + && (!TREE_CHAIN (parms) || TREE_CHAIN (parms) == void_list_node)) + /* For a function parameter pack that occurs at the end of the + parameter-declaration-list, the type A of each remaining + argument of the call is compared with the type P of the + declarator-id of the function parameter pack. */ + break; + parms = TREE_CHAIN (parms); + + if (TREE_CODE (parm) == TYPE_PACK_EXPANSION) + /* For a function parameter pack that does not occur at the + end of the parameter-declaration-list, the type of the + parameter pack is a non-deduced context. */ + continue; + arg = args[ia]; ++ia; arg_expr = NULL; |