aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/friend.c
diff options
context:
space:
mode:
authorVille Voutilainen <ville.voutilainen@gmail.com>2014-08-12 20:06:11 +0300
committerJason Merrill <jason@gcc.gnu.org>2014-08-12 13:06:11 -0400
commit253e34040c869ba73d0eca1d48895b147688ab29 (patch)
tree388aa403ff91bb1df810e0502a5a6c03a503779d /gcc/cp/friend.c
parentcaff45a63534858a06e9a8f4f1d878e25f5be88a (diff)
downloadgcc-253e34040c869ba73d0eca1d48895b147688ab29.zip
gcc-253e34040c869ba73d0eca1d48895b147688ab29.tar.gz
gcc-253e34040c869ba73d0eca1d48895b147688ab29.tar.bz2
Reject virt-specifiers on friends and member templates
Reject virt-specifiers on friends and member templates * friend.c (do_friend): Diagnose virt-specifiers. * pt.c (push_template_decl_real): Diagnose virt-specifiers. From-SVN: r213874
Diffstat (limited to 'gcc/cp/friend.c')
-rw-r--r--gcc/cp/friend.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
index a30918c..aa66c58 100644
--- a/gcc/cp/friend.c
+++ b/gcc/cp/friend.c
@@ -427,6 +427,10 @@ do_friend (tree ctype, tree declarator, tree decl,
/* Every decl that gets here is a friend of something. */
DECL_FRIEND_P (decl) = 1;
+ if (DECL_OVERRIDE_P (decl) || DECL_FINAL_P (decl))
+ error ("friend declaration %qD may not have virt-specifiers",
+ decl);
+
/* Unfortunately, we have to handle attributes here. Normally we would
handle them in start_decl_1, but since this is a friend decl start_decl_1
never gets to see it. */