2006-05-17 Mark Mitchell <mark@codesourcery.com>
+ PR c++/26122
+ * decl2.c (check_member_template): Remove checks for virtual
+ functions.
+ * parser.c (cp_parser_function_specifier_opt): Complain about
+ virtual templates.
+ (cp_parser_pure_specifier): Likewise.
+
PR c++/26068
* parser.c (cp_parser_set_storage_class): Check for
invalid uses of storage classes on unbraced linkage
error ("invalid declaration of member template %q#D in local class",
decl);
- if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl))
- {
- /* 14.5.2.3 [temp.mem]
-
- A member function template shall not be virtual. */
- error
- ("invalid use of %<virtual%> in template declaration of %q#D",
- decl);
- DECL_VIRTUAL_P (decl) = 0;
- }
+ /* The parser rejects any use of virtual in a function template. */
+ gcc_assert (!(TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_VIRTUAL_P (decl)));
/* The debug-information generating code doesn't know what to do
with member templates. */
break;
case RID_VIRTUAL:
- if (decl_specs)
+ /* 14.5.2.3 [temp.mem]
+
+ A member function template shall not be virtual. */
+ if (PROCESSING_REAL_TEMPLATE_DECL_P ())
+ error ("templates may not be %<virtual%>");
+ else if (decl_specs)
++decl_specs->specs[(int) ds_virtual];
break;
/* Look for the `0' token. */
token = cp_lexer_consume_token (parser->lexer);
/* c_lex_with_flags marks a single digit '0' with PURE_ZERO. */
- if (token->type == CPP_NUMBER && (token->flags & PURE_ZERO))
- return integer_zero_node;
+ if (token->type != CPP_NUMBER || !(token->flags & PURE_ZERO))
+ {
+ cp_parser_error (parser,
+ "invalid pure specifier (only `= 0' is allowed)");
+ cp_parser_skip_to_end_of_statement (parser);
+ return error_mark_node;
+ }
+ if (PROCESSING_REAL_TEMPLATE_DECL_P ())
+ {
+ error ("templates may not be %<virtual%>");
+ return error_mark_node;
+ }
- cp_parser_error (parser, "invalid pure specifier (only `= 0' is allowed)");
- cp_parser_skip_to_end_of_statement (parser);
- return error_mark_node;
+ return integer_zero_node;
}
/* Parse a constant-initializer.
2006-05-17 Mark Mitchell <mark@codesourcery.com>
+ PR c++/26122
+ * g++.old-deja/g++.oliva/template9.C: Remove XFAIL.
+
PR c++/26068
* g++.dg/opt/pr17697-3.C: Remove invalid extern specifier.
* g++.dg/parse/linkage1.C: New test.