2007-11-13 Jakub Jelinek <jakub@redhat.com>
+ PR c++/34054
+ PR c++/34056
+ PR c++/34057
+ PR c++/34058
+ PR c++/34060
+ * pt.c (find_parameter_packs_r): If ppd->set_packs_to_error,
+ set to error_mark_node the outermost POINTER_TYPE to the pack if
+ it is seen in a POINTER_TYPE.
+ (push_template_decl_real): If check_for_bare_parameter_packs
+ fails for function return type, set the return type to
+ integer_type_node. If check_for_bare_parameter_packs failed
+ for non-function, return error_mark_node.
+
PR c++/29225
* call.c (build_new_op): Call resolve_args before calling
build_over_call.
return NULL_TREE;
}
+recheck:
/* Identify whether this is a parameter pack or not. */
switch (TREE_CODE (t))
{
}
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;
ppd, NULL);
*walk_subtrees = 0;
return NULL_TREE;
-
case TYPE_PACK_EXPANSION:
case EXPR_PACK_EXPANSION:
/* Check for bare parameter packs in the return type and the
exception specifiers. */
- 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
- 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)
return process_partial_specialization (decl);
2007-11-13 Jakub Jelinek <jakub@redhat.com>
+ PR c++/34054
+ PR c++/34056
+ PR c++/34057
+ PR c++/34058
+ PR c++/34060
+ * g++.dg/parse/crash36.C: Add another dg-error.
+ * g++.dg/cpp0x/pr34054.C: New test.
+ * g++.dg/cpp0x/pr34056.C: New test.
+ * g++.dg/cpp0x/pr34057.C: New test.
+ * g++.dg/cpp0x/pr34058.C: New test.
+ * g++.dg/cpp0x/pr34060.C: New test.
+
PR tree-optimization/34063
* g++.dg/tree-ssa/pr34063.C: New test.
--- /dev/null
+// PR c++/34054
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+template<typename... T> T foo() {} // { dg-error "not expanded|T" }
--- /dev/null
+// PR c++/34056
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+template<typename... T> struct A
+{
+ void foo (T *) { ++p; } // { dg-error "not expanded|T" }
+ void bar (T **) { } // { dg-error "not expanded|T" }
+ T *p; // { dg-error "not expanded|T" }
+};
--- /dev/null
+// PR c++/34057
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+template <typename... T> struct A
+{
+ typedef T X __attribute__ ((vector_size (8))); // { dg-error "not expanded|T" }
+};
--- /dev/null
+// PR c++/34058
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+template <typename...T> struct A
+{
+ typedef T X; // { dg-error "not expanded|T" }
+};
+
+A<int> a;
--- /dev/null
+// PR c++/34060
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+template <int> struct A
+{
+ template <typename... > struct B {};
+ template <typename... T> struct B <int, T *> {}; // { dg-error "not expanded|T" }
+};
+
+A<0>::B<int>b;
template <typename... T> struct A // { dg-error "does not include variadic templates" }
{
static T &t; // { dg-error "not expanded with|T" }
- static const int i = sizeof (++t);
+ static const int i = sizeof (++t); // { dg-error "was not declared in this scope" }
};
int x[A <int>::i]; // { dg-error "is not an integral constant-expression" }