aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <doug.gregor@gmail.com>2008-01-29 13:59:59 +0000
committerDoug Gregor <dgregor@gcc.gnu.org>2008-01-29 13:59:59 +0000
commit7b3e2d465d6f267d34a18b46c1ab6650c67785d9 (patch)
tree21edc5a5f99ef49778039546b761a20f1c6831c6
parentf66816e8726d9bb12d2163f4ca8404b2b22cb15f (diff)
downloadgcc-7b3e2d465d6f267d34a18b46c1ab6650c67785d9.zip
gcc-7b3e2d465d6f267d34a18b46c1ab6650c67785d9.tar.gz
gcc-7b3e2d465d6f267d34a18b46c1ab6650c67785d9.tar.bz2
re PR c++/34055 (ICE with invalid specialization of variadic template)
2008-01-29 Douglas Gregor <doug.gregor@gmail.com> PR c++/34055 PR c++/34103 PR c++/34219 PR c++/34606 PR c++/34753 PR c++/34754 PR c++/34755 PR c++/34919 PR c++/34961 * c-pretty-print.c (pp_c_type_qualifier_list): Don't try to print qualifiers for an ERROR_MARK_NODE or a NULL_TREE. 2008-01-29 Douglas Gregor <doug.gregor@gmail.com> PR c++/34055 PR c++/34103 PR c++/34219 PR c++/34606 PR c++/34753 PR c++/34754 PR c++/34755 PR c++/34919 PR c++/34961 * typeck.c (check_return_expr): Tweak call to check_for_bare_parameter_packs. * class.c (add_method): Be careful with error_mark_nodes. * cp-tree.h (check_for_bare_parameter_packs): Remove "*" from signature. * pt.c (struct find_parameter_pack_data): Remove SET_PACKS_TO_ERROR. (find_parameter_packs_r): Don't use SET_PACKS_TO_ERROR. (uses_parameter_packs): Don't set SET_PACKS_TO_ERROR. (make_pack_expansion): Ditto. (check_for_bare_parameter_packs): Parameter is now a tree, not a tree*. (process_template_parm): Tweak call to check_for_bare_parameter_packs. (push_template_decl_real): Tweak calls to check_for_bare_parameter_packs. If bare parameter packs are found in the list of exceptions, clear out that list after giving an error. * semantics.c (finish_cond): Tweak call to check_for_bare_parameter_packs. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_switch_cond): Ditto. (finish_mem_initializers): Ditto. (finish_member_declaration): Ditto. (finish_static_assert): Check for bare parameter packs in the condition. * decl2.c (cplus_decl_attributes): Check for bare parameter packs in the attributes of a declaration. * parser.c (cp_parser_using_declaration): Tweak call to check_for_bare_parameter_packs. (cp_parser_base_clause): Ditto. 2008-01-29 Douglas Gregor <doug.gregor@gmail.com> PR c++/34055 PR c++/34103 PR c++/34219 PR c++/34606 PR c++/34753 PR c++/34754 PR c++/34755 PR c++/34919 PR c++/34961 * g++.dg/cpp0x/vt-34219-2.C: New. * g++.dg/cpp0x/pr32126.C: Tweak expected error messages. * g++.dg/cpp0x/vt-34961.C: New. * g++.dg/cpp0x/vt-34055.C: Tweak error messages; add new test cases from the re-opened PR. * g++.dg/cpp0x/vt-34753.C: New. * g++.dg/cpp0x/vt-34919.C: New. * g++.dg/cpp0x/vt-34754.C: New. * g++.dg/cpp0x/vt-34606.C: New. * g++.dg/cpp0x/vt-34219.C: New. * g++.dg/cpp0x/pr32125.C: Tweak expected error messages. * g++.dg/cpp0x/vt-34755.C: New. * g++.dg/cpp0x/pr31438.C: Ditto. * g++.dg/cpp0x/variadic81.C: Ditto. From-SVN: r131938
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/c-pretty-print.c5
-rw-r--r--gcc/cp/ChangeLog44
-rw-r--r--gcc/cp/class.c2
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/decl.c6
-rw-r--r--gcc/cp/decl2.c3
-rw-r--r--gcc/cp/parser.c6
-rw-r--r--gcc/cp/pt.c61
-rw-r--r--gcc/cp/semantics.c17
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/testsuite/ChangeLog26
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr31438.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr32125.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr32126.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic81.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/vt-34055.C29
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/vt-34219-2.C22
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/vt-34219.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/vt-34606.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/vt-34753.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/vt-34754.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/vt-34755.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/vt-34919.C13
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/vt-34961.C7
25 files changed, 256 insertions, 71 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4166941..a827f0d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2008-01-29 Douglas Gregor <doug.gregor@gmail.com>
+
+ PR c++/34055
+ PR c++/34103
+ PR c++/34219
+ PR c++/34606
+ PR c++/34753
+ PR c++/34754
+ PR c++/34755
+ PR c++/34919
+ PR c++/34961
+ * c-pretty-print.c (pp_c_type_qualifier_list): Don't try to print
+ qualifiers for an ERROR_MARK_NODE or a NULL_TREE.
+
2008-01-28 Andy Hutchinson <hutchinsonandy@netscape.net>
PR target/34412
diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c
index e9a6bbb..c8443d3 100644
--- a/gcc/c-pretty-print.c
+++ b/gcc/c-pretty-print.c
@@ -225,7 +225,10 @@ pp_c_space_for_pointer_operator (c_pretty_printer *pp, tree t)
void
pp_c_type_qualifier_list (c_pretty_printer *pp, tree t)
{
- int qualifiers;
+ int qualifiers;
+
+ if (!t || t == error_mark_node)
+ return;
if (!TYPE_P (t))
t = TREE_TYPE (t);
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7b5da53..ea850a5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,47 @@
+2008-01-29 Douglas Gregor <doug.gregor@gmail.com>
+
+ PR c++/34055
+ PR c++/34103
+ PR c++/34219
+ PR c++/34606
+ PR c++/34753
+ PR c++/34754
+ PR c++/34755
+ PR c++/34919
+ PR c++/34961
+ * typeck.c (check_return_expr): Tweak call to
+ check_for_bare_parameter_packs.
+ * class.c (add_method): Be careful with error_mark_nodes.
+ * cp-tree.h (check_for_bare_parameter_packs): Remove "*" from
+ signature.
+ * pt.c (struct find_parameter_pack_data): Remove
+ SET_PACKS_TO_ERROR.
+ (find_parameter_packs_r): Don't use SET_PACKS_TO_ERROR.
+ (uses_parameter_packs): Don't set SET_PACKS_TO_ERROR.
+ (make_pack_expansion): Ditto.
+ (check_for_bare_parameter_packs): Parameter is now a tree, not a
+ tree*.
+ (process_template_parm): Tweak call to
+ check_for_bare_parameter_packs.
+ (push_template_decl_real): Tweak calls to
+ check_for_bare_parameter_packs. If bare parameter packs are found
+ in the list of exceptions, clear out that list after giving an
+ error.
+ * semantics.c (finish_cond): Tweak call to
+ check_for_bare_parameter_packs.
+ (finish_expr_stmt): Ditto.
+ (finish_for_expr): Ditto.
+ (finish_switch_cond): Ditto.
+ (finish_mem_initializers): Ditto.
+ (finish_member_declaration): Ditto.
+ (finish_static_assert): Check for bare parameter packs in the
+ condition.
+ * decl2.c (cplus_decl_attributes): Check for bare parameter packs in the
+ attributes of a declaration.
+ * parser.c (cp_parser_using_declaration): Tweak call to
+ check_for_bare_parameter_packs.
+ (cp_parser_base_clause): Ditto.
+
2008-01-28 Jason Merrill <jason@redhat.com>
PR c++/35007
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 9f7d986..7560dbe 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1040,6 +1040,8 @@ add_method (tree type, tree method, tree using_decl)
coming from the using class in overload resolution. */
if (! DECL_STATIC_FUNCTION_P (fn)
&& ! DECL_STATIC_FUNCTION_P (method)
+ && TREE_TYPE (TREE_VALUE (parms1)) != error_mark_node
+ && TREE_TYPE (TREE_VALUE (parms2)) != error_mark_node
&& (TYPE_QUALS (TREE_TYPE (TREE_VALUE (parms1)))
!= TYPE_QUALS (TREE_TYPE (TREE_VALUE (parms2)))))
continue;
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index f954da5..5f43c13 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4435,7 +4435,7 @@ extern int comp_template_parms (const_tree, const_tree);
extern bool uses_parameter_packs (tree);
extern bool template_parameter_pack_p (const_tree);
extern tree make_pack_expansion (tree);
-extern bool check_for_bare_parameter_packs (tree*);
+extern bool check_for_bare_parameter_packs (tree);
extern tree get_template_info (tree);
extern int template_class_depth (tree);
extern int is_specialization_of (tree, tree);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 8fa0825..21db36e 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5388,6 +5388,12 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
type_dependent_p = dependent_type_p (type);
+ if (check_for_bare_parameter_packs (init))
+ {
+ init = NULL_TREE;
+ DECL_INITIAL (decl) = NULL_TREE;
+ }
+
if (init && init_const_expr_p)
{
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl) = 1;
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index fa8d28a..3b20586 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1107,6 +1107,9 @@ cplus_decl_attributes (tree *decl, tree attributes, int flags)
if (processing_template_decl)
{
+ if (check_for_bare_parameter_packs (attributes))
+ return;
+
save_template_attributes (&attributes, decl);
if (attributes == NULL_TREE)
return;
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index e661448..a648983 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -11776,7 +11776,7 @@ cp_parser_using_declaration (cp_parser* parser,
/* Create the USING_DECL. */
decl = do_class_using_decl (parser->scope, identifier);
- if (check_for_bare_parameter_packs (&decl))
+ if (check_for_bare_parameter_packs (decl))
return false;
else
/* Add it to the list of members in this class. */
@@ -11787,7 +11787,7 @@ cp_parser_using_declaration (cp_parser* parser,
decl = cp_parser_lookup_name_simple (parser, identifier);
if (decl == error_mark_node)
cp_parser_name_lookup_error (parser, identifier, decl, NULL);
- else if (check_for_bare_parameter_packs (&decl))
+ else if (check_for_bare_parameter_packs (decl))
return false;
else if (!at_namespace_scope_p ())
do_local_using_decl (decl, qscope, identifier);
@@ -15327,7 +15327,7 @@ cp_parser_base_clause (cp_parser* parser)
TREE_VALUE (base) = make_pack_expansion (TREE_VALUE (base));
- if (!check_for_bare_parameter_packs (&TREE_VALUE (base)))
+ if (!check_for_bare_parameter_packs (TREE_VALUE (base)))
{
TREE_CHAIN (base) = bases;
bases = base;
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 56fcd4d..b5caf5c 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -2434,10 +2434,6 @@ struct find_parameter_pack_data
/* Set of AST nodes that have been visited by the traversal. */
struct pointer_set_t *visited;
-
- /* Whether we should replace parameter packs with
- ERROR_MARK_NODE. Used by check_for_bare_parameter_packs. */
- bool set_packs_to_error;
};
/* Identifies all of the argument packs that occur in a template
@@ -2452,15 +2448,13 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
(struct find_parameter_pack_data*)data;
bool parameter_pack_p = false;
- /* Don't visit nodes twice, except when we're clearing out parameter
- packs. */
+ /* Don't visit nodes twice. */
if (pointer_set_contains (ppd->visited, *tp))
{
*walk_subtrees = 0;
return NULL_TREE;
}
-recheck:
/* Identify whether this is a parameter pack or not. */
switch (TREE_CODE (t))
{
@@ -2485,16 +2479,6 @@ recheck:
}
break;
- case POINTER_TYPE:
- if (ppd->set_packs_to_error)
- /* Pointer types are shared, set in that case the outermost
- POINTER_TYPE to error_mark_node rather than the parameter pack. */
- {
- t = TREE_TYPE (t);
- goto recheck;
- }
- break;
-
default:
/* Not a parameter pack. */
break;
@@ -2504,19 +2488,10 @@ recheck:
{
/* Add this parameter pack to the list. */
*ppd->parameter_packs = tree_cons (NULL_TREE, t, *ppd->parameter_packs);
-
- if (ppd->set_packs_to_error)
- /* The caller requested that we set the parameter packs to
- ERROR_MARK_NODE so that they will not trip up the compiler
- later. The caller is responsible for emitting an error. */
- *tp = error_mark_node;
- else
- /* Make sure we do not visit this node again. */
- pointer_set_insert (ppd->visited, *tp);
}
- else
- /* Make sure we do not visit this node again. */
- pointer_set_insert (ppd->visited, *tp);
+
+ /* Make sure we do not visit this node again. */
+ pointer_set_insert (ppd->visited, *tp);
if (TYPE_P (t))
cp_walk_tree (&TYPE_CONTEXT (t),
@@ -2602,7 +2577,6 @@ uses_parameter_packs (tree t)
struct find_parameter_pack_data ppd;
ppd.parameter_packs = &parameter_packs;
ppd.visited = pointer_set_create ();
- ppd.set_packs_to_error = false;
cp_walk_tree (&t, &find_parameter_packs_r, &ppd, NULL);
pointer_set_destroy (ppd.visited);
return parameter_packs != NULL_TREE;
@@ -2621,8 +2595,6 @@ make_pack_expansion (tree arg)
bool for_types = false;
struct find_parameter_pack_data ppd;
- ppd.set_packs_to_error = false;
-
if (!arg || arg == error_mark_node)
return arg;
@@ -2744,21 +2716,20 @@ make_pack_expansion (tree arg)
Returns TRUE and emits an error if there were bare parameter packs,
returns FALSE otherwise. */
bool
-check_for_bare_parameter_packs (tree* t)
+check_for_bare_parameter_packs (tree t)
{
tree parameter_packs = NULL_TREE;
struct find_parameter_pack_data ppd;
- if (!processing_template_decl || !t || !*t || *t == error_mark_node)
+ if (!processing_template_decl || !t || t == error_mark_node)
return false;
- if (TREE_CODE (*t) == TYPE_DECL)
- t = &TREE_TYPE (*t);
+ if (TREE_CODE (t) == TYPE_DECL)
+ t = TREE_TYPE (t);
ppd.parameter_packs = &parameter_packs;
ppd.visited = pointer_set_create ();
- ppd.set_packs_to_error = false;
- cp_walk_tree (t, &find_parameter_packs_r, &ppd, NULL);
+ cp_walk_tree (&t, &find_parameter_packs_r, &ppd, NULL);
pointer_set_destroy (ppd.visited);
if (parameter_packs)
@@ -2789,8 +2760,7 @@ check_for_bare_parameter_packs (tree* t)
tree. */
ppd.parameter_packs = &parameter_packs;
ppd.visited = pointer_set_create ();
- ppd.set_packs_to_error = true;
- cp_walk_tree (t, &find_parameter_packs_r, &ppd, NULL);
+ cp_walk_tree (&t, &find_parameter_packs_r, &ppd, NULL);
pointer_set_destroy (ppd.visited);
return true;
@@ -3055,7 +3025,7 @@ process_template_parm (tree list, tree parm, bool is_non_type,
{
/* This template parameter is not a parameter pack, but it
should be. Complain about "bare" parameter packs. */
- check_for_bare_parameter_packs (&TREE_TYPE (parm));
+ check_for_bare_parameter_packs (TREE_TYPE (parm));
/* Recover by calling this a parameter pack. */
is_parameter_pack = true;
@@ -3895,7 +3865,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
@@ -3911,14 +3881,15 @@ 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));
+ if (check_for_bare_parameter_packs (TYPE_RAISES_EXCEPTIONS (type)))
+ TYPE_RAISES_EXCEPTIONS (type) = NULL_TREE;
}
- 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)
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 5afc701..928975a 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -508,7 +508,7 @@ finish_cond (tree *cond_p, tree expr)
if (TREE_CODE (cond) == DECL_EXPR)
expr = cond;
- if (check_for_bare_parameter_packs (&expr))
+ if (check_for_bare_parameter_packs (expr))
*cond_p = error_mark_node;
}
*cond_p = expr;
@@ -619,7 +619,7 @@ finish_expr_stmt (tree expr)
else if (!type_dependent_expression_p (expr))
convert_to_void (build_non_dependent_expr (expr), "statement");
- if (check_for_bare_parameter_packs (&expr))
+ if (check_for_bare_parameter_packs (expr))
expr = error_mark_node;
/* Simplification of inner statement expressions, compound exprs,
@@ -877,7 +877,7 @@ finish_for_expr (tree expr, tree for_stmt)
else if (!type_dependent_expression_p (expr))
convert_to_void (build_non_dependent_expr (expr), "3rd expression in for");
expr = maybe_cleanup_point_expr_void (expr);
- if (check_for_bare_parameter_packs (&expr))
+ if (check_for_bare_parameter_packs (expr))
expr = error_mark_node;
FOR_EXPR (for_stmt) = expr;
}
@@ -974,7 +974,7 @@ finish_switch_cond (tree cond, tree switch_stmt)
cond = index;
}
}
- if (check_for_bare_parameter_packs (&cond))
+ if (check_for_bare_parameter_packs (cond))
cond = error_mark_node;
finish_cond (&SWITCH_STMT_COND (switch_stmt), cond);
SWITCH_STMT_TYPE (switch_stmt) = orig_type;
@@ -1393,7 +1393,7 @@ finish_mem_initializers (tree mem_inits)
bound as part of the TREE_PURPOSE. See
make_pack_expansion for more information. */
if (TREE_CODE (TREE_PURPOSE (mem)) != TYPE_PACK_EXPANSION
- && check_for_bare_parameter_packs (&TREE_VALUE (mem)))
+ && check_for_bare_parameter_packs (TREE_VALUE (mem)))
TREE_VALUE (mem) = error_mark_node;
}
@@ -2331,9 +2331,9 @@ finish_member_declaration (tree decl)
/* Check for bare parameter packs in the member variable declaration. */
if (TREE_CODE (decl) == FIELD_DECL)
{
- if (check_for_bare_parameter_packs (&TREE_TYPE (decl)))
+ if (check_for_bare_parameter_packs (TREE_TYPE (decl)))
TREE_TYPE (decl) = error_mark_node;
- if (check_for_bare_parameter_packs (&DECL_ATTRIBUTES (decl)))
+ if (check_for_bare_parameter_packs (DECL_ATTRIBUTES (decl)))
DECL_ATTRIBUTES (decl) = NULL_TREE;
}
@@ -4025,6 +4025,9 @@ void
finish_static_assert (tree condition, tree message, location_t location,
bool member_p)
{
+ if (check_for_bare_parameter_packs (condition))
+ condition = error_mark_node;
+
if (type_dependent_expression_p (condition)
|| value_dependent_expression_p (condition))
{
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index d86adcd..fd2a319 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -6605,7 +6605,7 @@ check_return_expr (tree retval, bool *no_warning)
if (processing_template_decl)
{
current_function_returns_value = 1;
- if (check_for_bare_parameter_packs (&retval))
+ if (check_for_bare_parameter_packs (retval))
retval = error_mark_node;
return retval;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d592993..832e1e8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,29 @@
+2008-01-29 Douglas Gregor <doug.gregor@gmail.com>
+
+ PR c++/34055
+ PR c++/34103
+ PR c++/34219
+ PR c++/34606
+ PR c++/34753
+ PR c++/34754
+ PR c++/34755
+ PR c++/34919
+ PR c++/34961
+ * g++.dg/cpp0x/vt-34219-2.C: New.
+ * g++.dg/cpp0x/pr32126.C: Tweak expected error messages.
+ * g++.dg/cpp0x/vt-34961.C: New.
+ * g++.dg/cpp0x/vt-34055.C: Tweak error messages; add new test
+ cases from the re-opened PR.
+ * g++.dg/cpp0x/vt-34753.C: New.
+ * g++.dg/cpp0x/vt-34919.C: New.
+ * g++.dg/cpp0x/vt-34754.C: New.
+ * g++.dg/cpp0x/vt-34606.C: New.
+ * g++.dg/cpp0x/vt-34219.C: New.
+ * g++.dg/cpp0x/pr32125.C: Tweak expected error messages.
+ * g++.dg/cpp0x/vt-34755.C: New.
+ * g++.dg/cpp0x/pr31438.C: Ditto.
+ * g++.dg/cpp0x/variadic81.C: Ditto.
+
2008-01-29 Richard Sandiford <rsandifo@nildram.co.uk>
* g++.dg/torture/pr34641.C: Put the dg-do first.
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr31438.C b/gcc/testsuite/g++.dg/cpp0x/pr31438.C
index 0e27971..4763918 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr31438.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr31438.C
@@ -1,9 +1,9 @@
// { dg-options "-std=gnu++0x" }
template<typename> struct A;
-template<typename T, typename... U> struct A<T(U)> // { dg-error "parameter packs|U|not used|U" }
-{
- template<typename X> A(X);
+template<typename T, typename... U> struct A<T(U)> // { dg-error "parameter packs|U" }
+{ // { dg-error "parameter packs|U" }
+ template<typename X> A(X); // { dg-error "parameter packs|U" }
};
A<void(int)> a(0); // { dg-error "incomplete type" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr32125.C b/gcc/testsuite/g++.dg/cpp0x/pr32125.C
index 154cd85..048cf45 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr32125.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr32125.C
@@ -1,8 +1,8 @@
// { dg-options "-std=c++0x" }
template<typename...> struct A;
-template<typename...T> struct A<T*> // { dg-error "not expanded|T|not used|T" }
-{
- A();
+template<typename...T> struct A<T*> // { dg-error "not expanded|T" }
+{ // { dg-error "not expanded|T" }
+ A(); // { dg-error "not expanded|T" }
A(T); // { dg-error "not expanded|T" }
};
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr32126.C b/gcc/testsuite/g++.dg/cpp0x/pr32126.C
index e7c61bd..a344567 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr32126.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr32126.C
@@ -1,8 +1,8 @@
// { dg-options "-std=c++0x" }
template<typename...> struct A;
-template<typename...T> struct A<T> // { dg-error "not expanded|T|not used|T" }
-{
+template<typename...T> struct A<T> // { dg-error "not expanded|T|" }
+{ // { dg-error "not expanded|T|" }
static int i;
};
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic81.C b/gcc/testsuite/g++.dg/cpp0x/variadic81.C
index 322f249..c567378 100644
--- a/gcc/testsuite/g++.dg/cpp0x/variadic81.C
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic81.C
@@ -4,7 +4,7 @@
template<typename> struct A;
template<typename... T> struct A<T*> // { dg-error "not expanded|T|not used|T" }
-{
+{ // { dg-error "not expanded|T|not used|T" }
struct B;
};
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-34055.C b/gcc/testsuite/g++.dg/cpp0x/vt-34055.C
index 921b813..8ad9c2d 100644
--- a/gcc/testsuite/g++.dg/cpp0x/vt-34055.C
+++ b/gcc/testsuite/g++.dg/cpp0x/vt-34055.C
@@ -1,10 +1,31 @@
// { dg-options "-std=c++0x" }
// PR c++/34055
-template<typename...> struct A; // { dg-error "declaration" }
+template<typename...> struct A;
template<typename...T> struct A<T*> // { dg-error "parameter packs|T" }
-{
- void foo();
+{ // { dg-error "parameter packs|T" }
+ void foo(); // { dg-error "parameter packs|T|candidate" }
};
-template<typename...T> void A<T*>::foo() {} // { dg-error "invalid use" }
+template<typename...T> void A<T*>::foo() {} // { dg-error "does not match" }
+
+
+
+template<typename...> struct B;
+
+template<typename...T> struct B<T&> // { dg-error "parameter packs|T" }
+{ // { dg-error "parameter packs|T" }
+ void foo(); // { dg-error "parameter packs|T" }
+};
+
+template<typename...T> void B<T&>::foo() {} // { dg-error "does not match" }
+
+
+template<typename...> struct C;
+
+template<typename...T> struct C<T()> // { dg-error "parameter packs|T" }
+{ // { dg-error "parameter packs|T" }
+ void foo(); // { dg-error "parameter packs|T" }
+};
+
+template<typename...T> void C<T()>::foo() {} // { dg-error "does not match" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-34219-2.C b/gcc/testsuite/g++.dg/cpp0x/vt-34219-2.C
new file mode 100644
index 0000000..193bc0c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/vt-34219-2.C
@@ -0,0 +1,22 @@
+// { dg-options "-std=c++0x" }
+template<template<typename... T> class Comp, typename... T> void f( T... Value)
+{
+ static_assert( Comp<T>::value > 0, "" ); // { dg-error "parameter packs|T" }
+}
+
+template<template<typename... T> class Comp, typename... T> void g( T... Value)
+{
+ static_assert( Comp<T...>::value > 0, "" );
+}
+
+template <typename... T>
+struct Foo
+{
+ static const int value=1;
+};
+
+int main()
+{
+ f<Foo>( 2 );
+ g<Foo>( 2 );
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-34219.C b/gcc/testsuite/g++.dg/cpp0x/vt-34219.C
new file mode 100644
index 0000000..fb3584e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/vt-34219.C
@@ -0,0 +1,15 @@
+// { dg-options "-std=c++0x" }
+template<typename T, T a, T... Params>
+struct max
+{
+ static const T value = a > max<T, Params>::value ? a : max<T, Params>::value; // { dg-error "not expanded|Params" }
+};
+
+template<typename T, T a, T b>
+struct max<T, a, b>
+{
+ static const T value = a > b ? a : b;
+};
+
+static const int value1 = max< int, 1, 2>::value;
+static const int value2 = max< int, 1, 3, 5>::value;
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-34606.C b/gcc/testsuite/g++.dg/cpp0x/vt-34606.C
new file mode 100644
index 0000000..f62e2d5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/vt-34606.C
@@ -0,0 +1,9 @@
+// { dg-options "-std=c++0x" }
+template<typename...> struct A;
+
+template<typename T, typename... U> struct A<T, U> // { dg-error "parameter packs|U" }
+{ // { dg-error "parameter packs|U" }
+ template<typename> struct B;
+
+ template<typename X> struct B<X*> {}; // { dg-error "parameter packs|U" }
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-34753.C b/gcc/testsuite/g++.dg/cpp0x/vt-34753.C
new file mode 100644
index 0000000..15eaebe
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/vt-34753.C
@@ -0,0 +1,14 @@
+// { dg-options "-std=c++0x" }
+template<typename... T> struct A
+{
+ template<T> struct B {}; // { dg-error "not expanded|T" }
+};
+
+A<int>::B<0> b;
+
+template<typename... T> struct B
+{
+ template<T> B(); // { dg-error "not expanded|T" }
+};
+
+B<int> c;
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-34754.C b/gcc/testsuite/g++.dg/cpp0x/vt-34754.C
new file mode 100644
index 0000000..97c0065
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/vt-34754.C
@@ -0,0 +1,6 @@
+// { dg-options "-std=c++0x" }
+template<template<int> class... T> struct A
+{
+ void foo(T<0>); // { dg-error "not expanded|T" }
+ void bar(T<0>); // { dg-error "not expanded|T" }
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-34755.C b/gcc/testsuite/g++.dg/cpp0x/vt-34755.C
new file mode 100644
index 0000000..9d5a3d1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/vt-34755.C
@@ -0,0 +1,6 @@
+// { dg-options "-std=c++0x" }
+template<typename> struct A {};
+
+template<template<typename> class... T> void foo(T<int>) {} // { dg-error "not expanded|T" }
+
+template void foo<A>(A<int>); // { dg-error "does not match" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-34919.C b/gcc/testsuite/g++.dg/cpp0x/vt-34919.C
new file mode 100644
index 0000000..8295799
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/vt-34919.C
@@ -0,0 +1,13 @@
+// { dg-options "-std=c++0x" }
+template<int... N> struct A
+{
+ static void foo()
+ {
+ int i = N; // { dg-error "not expanded|N" }
+ }
+};
+
+void bar()
+{
+ A<0>::foo();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-34961.C b/gcc/testsuite/g++.dg/cpp0x/vt-34961.C
new file mode 100644
index 0000000..3a87214
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/vt-34961.C
@@ -0,0 +1,7 @@
+// { dg-options "-std=c++0x" }
+template<typename... T> struct A
+{
+ static const int i __attribute__((aligned(__alignof(T)))) = 0; // { dg-error "not expanded|T" }
+};
+
+A<int> a;