aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorDouglas Gregor <doug.gregor@gmail.com>2008-01-15 18:08:00 +0000
committerDoug Gregor <dgregor@gcc.gnu.org>2008-01-15 18:08:00 +0000
commit4439d02f0f5881b186b7d3430a9504310e227e30 (patch)
tree86bf7020da1cd67cb456d3a5b266ad9a0edd947c /gcc/cp/pt.c
parenta022041e4ca05c32d7d17a26ce6f0716b4ba642f (diff)
downloadgcc-4439d02f0f5881b186b7d3430a9504310e227e30.zip
gcc-4439d02f0f5881b186b7d3430a9504310e227e30.tar.gz
gcc-4439d02f0f5881b186b7d3430a9504310e227e30.tar.bz2
re PR c++/34051 (ICE in dependent_type_p with variadic templates)
2008-01-15 Douglas Gregor <doug.gregor@gmail.com> PR c++/34051 PR c++/34055 PR c++/34102 PR c++/34103 * typeck.c (check_return_expr): If there are bare parameter packs in the return value, set it to error_mark_node. * tree.c (cp_walk_subtrees): Walk USING_DECL nodes. * pt.c (find_parameter_packs_r): Look at the type of IDENTIFIER_NODEs (e.g., for user-defined conversions). (check_for_bare_parameter_packs): Flip the result: now returns TRUE when there were bare parameter packs, FALSE otherwise. (push_template_decl_real): Deal with flipped result of check_for_bare_parameter_packs. * semantics.c (finish_cond): If there are bare parameter packs in the conditional, set it to error_mark_node. (finish_expr_stmt): If there are bare parameter packs in the expression, set it to error_mark_node. (finish_for_expr): Ditto. (finish_switch_cond): If there are bare parameter packs in the conditional, set it to error_mark_node. (finish_mem_initializers): If there are bare parameter packs in the member initializer, set it to error_mark_node. (finish_member_declaration): Check the attributes of the declaration for bare parameter packs, and remove the attributes if any have bare parameter packs. * parser.c (cp_parser_using_declaration): Check the using declaration for bare parameter packs. (cp_parser_base_clause): If there are bare parameter packs in a base specifier, don't add it to the chain. 2008-01-15 Douglas Gregor <doug.gregor@gmail.com> PR c++/34051 PR c++/34055 PR c++/34102 PR c++/34103 * g++.dg/cpp0x/vt-34051-2.C: New. * g++.dg/cpp0x/vt-34102.C: New. * g++.dg/cpp0x/vt-34051.C: New. * g++.dg/cpp0x/vt-34055.C: New. * g++.dg/cpp0x/vt-34103.C: New. From-SVN: r131547
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index d364b20..57dc8f8 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -2577,6 +2577,11 @@ recheck:
*walk_subtrees = 0;
return NULL_TREE;
+ case IDENTIFIER_NODE:
+ cp_walk_tree (&TREE_TYPE (t), &find_parameter_packs_r, ppd, NULL);
+ *walk_subtrees = 0;
+ return NULL_TREE;
+
default:
return NULL_TREE;
}
@@ -2731,8 +2736,8 @@ make_pack_expansion (tree arg)
g(h(args)), or f(g(h(args))), because we would produce erroneous
error messages.
- Returns TRUE if there were no bare parameter packs, returns FALSE
- (and emits an error) if there were bare parameter packs.*/
+ Returns TRUE and emits an error if there were bare parameter packs,
+ returns FALSE otherwise. */
bool
check_for_bare_parameter_packs (tree* t)
{
@@ -2740,7 +2745,7 @@ check_for_bare_parameter_packs (tree* t)
struct find_parameter_pack_data ppd;
if (!processing_template_decl || !t || !*t || *t == error_mark_node)
- return true;
+ return false;
if (TREE_CODE (*t) == TYPE_DECL)
t = &TREE_TYPE (*t);
@@ -2783,10 +2788,10 @@ check_for_bare_parameter_packs (tree* t)
cp_walk_tree (t, &find_parameter_packs_r, &ppd, NULL);
pointer_set_destroy (ppd.visited);
- return false;
+ return true;
}
- return true;
+ return false;
}
/* Expand any parameter packs that occur in the template arguments in
@@ -3885,7 +3890,7 @@ push_template_decl_real (tree decl, bool is_friend)
while (arg && argtype)
{
if (!FUNCTION_PARAMETER_PACK_P (arg)
- && !check_for_bare_parameter_packs (&TREE_TYPE (arg)))
+ && check_for_bare_parameter_packs (&TREE_TYPE (arg)))
{
/* This is a PARM_DECL that contains unexpanded parameter
packs. We have already complained about this in the
@@ -3901,14 +3906,14 @@ push_template_decl_real (tree decl, bool is_friend)
/* Check for bare parameter packs in the return type and the
exception specifiers. */
- if (!check_for_bare_parameter_packs (&TREE_TYPE (type)))
+ if (check_for_bare_parameter_packs (&TREE_TYPE (type)))
/* Errors were already issued, set return type to int
as the frontend doesn't expect error_mark_node as
the return type. */
TREE_TYPE (type) = integer_type_node;
check_for_bare_parameter_packs (&TYPE_RAISES_EXCEPTIONS (type));
}
- else if (!check_for_bare_parameter_packs (&TREE_TYPE (decl)))
+ else if (check_for_bare_parameter_packs (&TREE_TYPE (decl)))
return error_mark_node;
if (is_partial)