aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog11
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/parser.c2
-rw-r--r--gcc/cp/pt.c18
4 files changed, 28 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 369a678..8b7eae9 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,14 @@
+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-27 Mark Mitchell <mark@codesourcery.com>
PR c++/28058
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index c50836b..3c20afe 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4111,7 +4111,7 @@ extern int template_class_depth (tree);
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);
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index a97518a..5271113 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -13287,7 +13287,7 @@ cp_parser_class_head (cp_parser* parser,
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);
}
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 17557c0..79d9de4 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -673,13 +673,20 @@ check_explicit_instantiation_namespace (tree spec)
/* 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);
@@ -764,7 +771,12 @@ maybe_process_partial_specialization (tree 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