diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4166941fbfd..a827f0df4f5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2008-01-29 Douglas Gregor + + 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 PR target/34412 diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c index e9a6bbb8872..c8443d31fcb 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 7b5da5349cd..ea850a5a8dc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,47 @@ +2008-01-29 Douglas Gregor + + 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 PR c++/35007 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 9f7d986676c..7560dbe3da7 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 f954da5d850..5f43c13d3d8 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 8fa0825c8b7..21db36e2095 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 fa8d28a2542..3b20586457c 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 e6614481290..a6489832d11 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 56fcd4db47d..b5caf5c7cb2 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 = ¶meter_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 = ¶meter_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 = ¶meter_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 5afc701e98f..928975ad130 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 d86adcd0335..fd2a3193a47 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 d592993f974..832e1e87b61 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,29 @@ +2008-01-29 Douglas Gregor + + 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 * 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 0e27971494b..4763918b0ef 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 struct A; -template struct A // { dg-error "parameter packs|U|not used|U" } -{ - template A(X); +template struct A // { dg-error "parameter packs|U" } +{ // { dg-error "parameter packs|U" } + template A(X); // { dg-error "parameter packs|U" } }; A 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 154cd85487d..048cf454484 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 struct A; -template struct A // { dg-error "not expanded|T|not used|T" } -{ - A(); +template struct A // { 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 e7c61bd0c3c..a344567dff9 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 struct A; -template struct A // { dg-error "not expanded|T|not used|T" } -{ +template struct A // { 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 322f249de9a..c5673789ca9 100644 --- a/gcc/testsuite/g++.dg/cpp0x/variadic81.C +++ b/gcc/testsuite/g++.dg/cpp0x/variadic81.C @@ -4,7 +4,7 @@ template struct A; template struct A // { 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 921b813c82e..8ad9c2d5266 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 struct A; // { dg-error "declaration" } +template struct A; template struct A // { dg-error "parameter packs|T" } -{ - void foo(); +{ // { dg-error "parameter packs|T" } + void foo(); // { dg-error "parameter packs|T|candidate" } }; -template void A::foo() {} // { dg-error "invalid use" } +template void A::foo() {} // { dg-error "does not match" } + + + +template struct B; + +template struct B // { dg-error "parameter packs|T" } +{ // { dg-error "parameter packs|T" } + void foo(); // { dg-error "parameter packs|T" } +}; + +template void B::foo() {} // { dg-error "does not match" } + + +template struct C; + +template struct C // { dg-error "parameter packs|T" } +{ // { dg-error "parameter packs|T" } + void foo(); // { dg-error "parameter packs|T" } +}; + +template void C::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 00000000000..193bc0c6cf9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/vt-34219-2.C @@ -0,0 +1,22 @@ +// { dg-options "-std=c++0x" } +template class Comp, typename... T> void f( T... Value) +{ + static_assert( Comp::value > 0, "" ); // { dg-error "parameter packs|T" } +} + +template class Comp, typename... T> void g( T... Value) +{ + static_assert( Comp::value > 0, "" ); +} + +template +struct Foo +{ + static const int value=1; +}; + +int main() +{ + f( 2 ); + g( 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 00000000000..fb3584ea88d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/vt-34219.C @@ -0,0 +1,15 @@ +// { dg-options "-std=c++0x" } +template +struct max +{ + static const T value = a > max::value ? a : max::value; // { dg-error "not expanded|Params" } +}; + +template +struct max +{ + 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 00000000000..f62e2d54118 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/vt-34606.C @@ -0,0 +1,9 @@ +// { dg-options "-std=c++0x" } +template struct A; + +template struct A // { dg-error "parameter packs|U" } +{ // { dg-error "parameter packs|U" } + template struct B; + + template struct B {}; // { 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 00000000000..15eaebebc88 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/vt-34753.C @@ -0,0 +1,14 @@ +// { dg-options "-std=c++0x" } +template struct A +{ + template struct B {}; // { dg-error "not expanded|T" } +}; + +A::B<0> b; + +template struct B +{ + template B(); // { dg-error "not expanded|T" } +}; + +B 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 00000000000..97c0065328f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/vt-34754.C @@ -0,0 +1,6 @@ +// { dg-options "-std=c++0x" } +template 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 00000000000..9d5a3d1ca4d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/vt-34755.C @@ -0,0 +1,6 @@ +// { dg-options "-std=c++0x" } +template struct A {}; + +template class... T> void foo(T) {} // { dg-error "not expanded|T" } + +template void foo(A); // { 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 00000000000..829579918e1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/vt-34919.C @@ -0,0 +1,13 @@ +// { dg-options "-std=c++0x" } +template 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 00000000000..3a872146e25 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/vt-34961.C @@ -0,0 +1,7 @@ +// { dg-options "-std=c++0x" } +template struct A +{ + static const int i __attribute__((aligned(__alignof(T)))) = 0; // { dg-error "not expanded|T" } +}; + +A a;