+2006-08-28 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ PR c++/28860
+ * cp-tree.h (maybe_process_partial_specialization): Return
+ tree instead of void.
+ * parser.c (cp_parser_class_head): Use return value of
+ maybe_process_partial_specialization.
+ * pt.c (maybe_process_partial_specialization): Return error_mark_node
+ for broken specializations, TYPE otherwise. Check for template
+ template parameters.
+
2006-08-25 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/28853
extern int is_specialization_of (tree, tree);
extern bool is_specialization_of_friend (tree, tree);
extern int comp_template_args (tree, tree);
-extern void maybe_process_partial_specialization (tree);
+extern tree maybe_process_partial_specialization (tree);
extern tree most_specialized_instantiation (tree);
extern void print_candidates (tree);
extern void instantiate_pending_templates (int);
if (template_id_p)
{
type = TREE_TYPE (id);
- maybe_process_partial_specialization (type);
+ type = maybe_process_partial_specialization (type);
if (nested_name_specifier)
pushed_scope = push_scope (nested_name_specifier);
}
/* The TYPE is being declared. If it is a template type, that means it
is a partial specialization. Do appropriate error-checking. */
-void
+tree
maybe_process_partial_specialization (tree type)
{
tree context;
if (type == error_mark_node)
- return;
+ return error_mark_node;
+
+ if (TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM)
+ {
+ error ("name of class shadows template template parameter %qD",
+ TYPE_NAME (type));
+ return error_mark_node;
+ }
context = TYPE_CONTEXT (type);
}
}
else if (processing_specialization)
- error ("explicit specialization of non-template %qT", type);
+ {
+ error ("explicit specialization of non-template %qT", type);
+ return error_mark_node;
+ }
+
+ return type;
}
/* Returns nonzero if we can optimize the retrieval of specializations
+2006-08-28 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ PR c++/28860
+ * g++.dg/template/ttp22.C: New test.
+
2006-08-25 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/28853
--- /dev/null
+// PR c++/28860
+// { dg-do compile}
+
+template<template<int> class A>
+class A<0>; // { dg-error "shadows template template parameter" }
+
+template<template<int> class B>
+class B<0> {}; // { dg-error "shadows template template parameter" }