aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 2a46d6f..c6c2c0c 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -12888,7 +12888,8 @@ cp_parser_function_specifier_opt (cp_parser* parser,
/* 14.5.2.3 [temp.mem]
A member function template shall not be virtual. */
- if (PROCESSING_REAL_TEMPLATE_DECL_P ())
+ if (PROCESSING_REAL_TEMPLATE_DECL_P ()
+ && current_class_type)
error_at (token->location, "templates may not be %<virtual%>");
else
set_and_check_decl_spec_loc (decl_specs, ds_virtual, token);