===================================================================
@@ -835,6 +835,19 @@ maybe_process_partial_specialization (tree type)
&& !COMPLETE_TYPE_P (type))
{
check_specialization_namespace (CLASSTYPE_TI_TEMPLATE (type));
+
+ int wanted = num_template_headers_for_class (type);
+ if (template_header_count != wanted)
+ {
+ if (template_header_count > wanted)
+ error ("too many template-parameter-lists for %E "
+ "(should be %d)", type, wanted);
+ else
+ error ("too few template-parameter-lists for %E "
+ "(should be %d)", type, wanted);
+ return error_mark_node;
+ }
+
SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (type);
if (processing_template_decl)
{
@@ -882,6 +895,18 @@ maybe_process_partial_specialization (tree type)
tree t;
tree tmpl = CLASSTYPE_TI_TEMPLATE (type);
+ int wanted = num_template_headers_for_class (type);
+ if (template_header_count != wanted)
+ {
+ if (template_header_count > wanted)
+ error ("too many template-parameter-lists for %E "
+ "(should be %d)", type, wanted);
+ else
+ error ("too few template-parameter-lists for %E "
+ "(should be %d)", type, wanted);
+ return error_mark_node;
+ }
+
if (current_namespace
!= decl_namespace_context (tmpl))
{
===================================================================
@@ -18528,7 +18528,7 @@ cp_parser_class_head (cp_parser* parser,
use "goto done;" to return. */
/* Make sure that the right number of template parameters were
present. */
- if (!cp_parser_check_template_parameters (parser, num_templates,
+ if (0 && !cp_parser_check_template_parameters (parser, num_templates,
type_start_token->location,
/*declarator=*/NULL))
{