aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-09-15 15:34:34 -0400
committerJason Merrill <jason@gcc.gnu.org>2013-09-15 15:34:34 -0400
commit73f4e2d261705d356b2283ae1576e495b74e7992 (patch)
tree73fd2b3744f6e61e6845b8bf67f1db8dbd5e42ee /gcc
parent018795f47711aa9d4a541a7bae0f27efeea66f12 (diff)
downloadgcc-73f4e2d261705d356b2283ae1576e495b74e7992.zip
gcc-73f4e2d261705d356b2283ae1576e495b74e7992.tar.gz
gcc-73f4e2d261705d356b2283ae1576e495b74e7992.tar.bz2
re PR c++/41933 ([c++0x] lambdas and variadic templates don't work together)
PR c++/41933 * cp-tree.h (DECL_PACK_P): Replace FUNCTION_PARAMETER_PACK_P. * cxx-pretty-print.c (direct_declarator): Adjust. * decl2.c (cp_build_parm_decl): Adjust. * pt.c (function_parameter_pack_p): Adjust. (find_parameter_packs_r, push_template_decl_real): Adjust. (tsubst_pack_expansion, tsubst_decl): Adjust. (regenerate_decl_from_template, instantiate_decl): Adjust. From-SVN: r202604
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/cp-tree.h8
-rw-r--r--gcc/cp/cxx-pretty-print.c2
-rw-r--r--gcc/cp/decl2.c5
-rw-r--r--gcc/cp/pt.c20
5 files changed, 21 insertions, 23 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index af243a2..9234ade 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,14 @@
2013-09-15 Jason Merrill <jason@redhat.com>
+ PR c++/41933
+ * cp-tree.h (DECL_PACK_P): Replace FUNCTION_PARAMETER_PACK_P.
+ * cxx-pretty-print.c (direct_declarator): Adjust.
+ * decl2.c (cp_build_parm_decl): Adjust.
+ * pt.c (function_parameter_pack_p): Adjust.
+ (find_parameter_packs_r, push_template_decl_real): Adjust.
+ (tsubst_pack_expansion, tsubst_decl): Adjust.
+ (regenerate_decl_from_template, instantiate_decl): Adjust.
+
* lambda.c (add_capture): Don't add DECL_LANG_SPECIFIC.
2013-09-13 Jason Merrill <jason@redhat.com>
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 0d8bd95..4680053 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -138,7 +138,6 @@ c-common.h, not after.
1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL).
DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL)
DECL_MEMBER_TEMPLATE_P (in TEMPLATE_DECL)
- FUNCTION_PARAMETER_PACK_P (in PARM_DECL)
USING_DECL_TYPENAME_P (in USING_DECL)
DECL_VLA_CAPTURE_P (in FIELD_DECL)
2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL).
@@ -2874,10 +2873,9 @@ extern void decl_shadowed_for_var_insert (tree, tree);
the class definition is complete. */
#define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
-/* Determine if a parameter (i.e., a PARM_DECL) is a function
- parameter pack. */
-#define FUNCTION_PARAMETER_PACK_P(NODE) \
- (DECL_LANG_FLAG_1 (PARM_DECL_CHECK (NODE)))
+/* Determine if a declaration (PARM_DECL or FIELD_DECL) is a pack. */
+#define DECL_PACK_P(NODE) \
+ (DECL_P (NODE) && PACK_EXPANSION_P (TREE_TYPE (NODE)))
/* Determines if NODE is an expansion of one or more parameter packs,
e.g., a TYPE_PACK_EXPANSION or EXPR_PACK_EXPANSION. */
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index 86d8b47..bcef876 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -1527,7 +1527,7 @@ cxx_pretty_printer::direct_declarator (tree t)
{
pp_cxx_space_for_pointer_operator (this, TREE_TYPE (t));
- if ((TREE_CODE (t) == PARM_DECL && FUNCTION_PARAMETER_PACK_P (t))
+ if ((TREE_CODE (t) == PARM_DECL && DECL_PACK_P (t))
|| template_parameter_pack_p (t))
/* A function parameter pack or non-type template
parameter pack. */
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index d5d2912..c518551 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -188,11 +188,6 @@ cp_build_parm_decl (tree name, tree type)
if (!processing_template_decl)
DECL_ARG_TYPE (parm) = type_passed_as (type);
- /* If the type is a pack expansion, then we have a function
- parameter pack. */
- if (type && TREE_CODE (type) == TYPE_PACK_EXPANSION)
- FUNCTION_PARAMETER_PACK_P (parm) = 1;
-
return parm;
}
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index fed004c..ecae904 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -2852,7 +2852,7 @@ bool
function_parameter_pack_p (const_tree t)
{
if (t && TREE_CODE (t) == PARM_DECL)
- return FUNCTION_PARAMETER_PACK_P (t);
+ return DECL_PACK_P (t);
return false;
}
@@ -3085,7 +3085,7 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
break;
case PARM_DECL:
- if (FUNCTION_PARAMETER_PACK_P (t))
+ if (DECL_PACK_P (t))
{
/* We don't want to walk into the type of a PARM_DECL,
because we don't want to see the type parameter pack. */
@@ -4646,7 +4646,7 @@ push_template_decl_real (tree decl, bool is_friend)
while (arg && argtype)
{
- if (!FUNCTION_PARAMETER_PACK_P (arg)
+ if (!DECL_PACK_P (arg)
&& check_for_bare_parameter_packs (TREE_TYPE (arg)))
{
/* This is a PARM_DECL that contains unexpanded parameter
@@ -9472,7 +9472,7 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
have the wrong value for a recursive call. Just make a
dummy decl, since it's only used for its type. */
arg_pack = tsubst_decl (parm_pack, args, complain);
- if (arg_pack && FUNCTION_PARAMETER_PACK_P (arg_pack))
+ if (arg_pack && DECL_PACK_P (arg_pack))
/* Partial instantiation of the parm_pack, we can't build
up an argument pack yet. */
arg_pack = NULL_TREE;
@@ -10465,7 +10465,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
tree prev_r = NULL_TREE;
tree first_r = NULL_TREE;
- if (FUNCTION_PARAMETER_PACK_P (t))
+ if (DECL_PACK_P (t))
{
/* If there is a local specialization that isn't a
parameter pack, it means that we're doing a "simple"
@@ -10515,10 +10515,6 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
/* We're on the Ith parameter of the function parameter
pack. */
{
- /* An argument of a function parameter pack is not a parameter
- pack. */
- FUNCTION_PARAMETER_PACK_P (r) = false;
-
/* Get the Ith type. */
type = TREE_VEC_ELT (expanded_types, i);
@@ -18705,7 +18701,7 @@ regenerate_decl_from_template (tree decl, tree tmpl)
pattern_parm
= skip_artificial_parms_for (code_pattern,
DECL_ARGUMENTS (code_pattern));
- while (decl_parm && !FUNCTION_PARAMETER_PACK_P (pattern_parm))
+ while (decl_parm && !DECL_PACK_P (pattern_parm))
{
tree parm_type;
tree attributes;
@@ -18728,7 +18724,7 @@ regenerate_decl_from_template (tree decl, tree tmpl)
}
/* Merge any parameters that match with the function parameter
pack. */
- if (pattern_parm && FUNCTION_PARAMETER_PACK_P (pattern_parm))
+ if (pattern_parm && DECL_PACK_P (pattern_parm))
{
int i, len;
tree expanded_types;
@@ -19247,7 +19243,7 @@ instantiate_decl (tree d, int defer_ok,
}
for (; tmpl_parm; tmpl_parm = DECL_CHAIN (tmpl_parm))
{
- if (!FUNCTION_PARAMETER_PACK_P (tmpl_parm))
+ if (!DECL_PACK_P (tmpl_parm))
{
register_local_specialization (spec_parm, tmpl_parm);
spec_parm = DECL_CHAIN (spec_parm);