aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2016-05-30 15:10:51 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2016-05-30 15:10:51 +0000
commita59775a17c7f9933f3d800557eb516a79ebe9bea (patch)
treec7c23ee68d8ebf6073ebdc1d427674d032309edb /gcc/cp
parent53d6d955606658b7fe0bb9356ad9d7191b61742c (diff)
downloadgcc-a59775a17c7f9933f3d800557eb516a79ebe9bea.zip
gcc-a59775a17c7f9933f3d800557eb516a79ebe9bea.tar.gz
gcc-a59775a17c7f9933f3d800557eb516a79ebe9bea.tar.bz2
re PR c++/71099 (Misleading diagnostic message with 'virtual' used in out-of-line definitions of class template member functions)
/cp 2016-05-30 Paolo Carlini <paolo.carlini@oracle.com> PR c++/71099 * parser.c (cp_parser_function_specifier_opt): Use current_class_type to improve the diagnostic about wrong uses of 'virtual'. /testsuite 2016-05-30 Paolo Carlini <paolo.carlini@oracle.com> PR c++/71099 * g++.dg/parse/virtual1.C: New. From-SVN: r236885
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b970c6e..9b35abc 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2016-05-30 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/71099
+ * parser.c (cp_parser_function_specifier_opt): Use current_class_type
+ to improve the diagnostic about wrong uses of 'virtual'.
+
2016-05-29 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/71105
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);