From: Ville Voutilainen Date: Fri, 21 Oct 2011 13:31:21 +0000 (+0300) Subject: re PR c++/50811 ([C++0x] G++ rejects class-virt-specifier if class-head-name includes... X-Git-Tag: releases/gcc-4.7.0~2917 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b9af306b979306215b1f999ca2636a0874717c9c;p=thirdparty%2Fgcc.git re PR c++/50811 ([C++0x] G++ rejects class-virt-specifier if class-head-name includes nested-name-specifier) PR c++/50811 * parser.c (cp_parser_class_head): Parse virt-specifiers regardless of whether an id is present From-SVN: r180301 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index df7e1bcf05c1..11994ee4b13e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-10-21 Ville Voutilainen + + PR c++/50811 + * parser.c (cp_parser_class_head): Parse virt-specifiers + regardless of whether an id is present + 2011-10-20 Jason Merrill PR c++/41449 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 8d138fb7b538..a762d9d91847 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -17853,8 +17853,8 @@ cp_parser_class_head (cp_parser* parser, { cp_parser_check_for_invalid_template_id (parser, id, type_start_token->location); - virt_specifiers = cp_parser_virt_specifier_seq_opt (parser); } + virt_specifiers = cp_parser_virt_specifier_seq_opt (parser); /* If it's not a `:' or a `{' then we can't really be looking at a class-head, since a class-head only appears as part of a diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b70d758b6b0c..a1b2752c45f4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-10-21 Ville Voutilainen + + PR c++/50811 + * g++.dg/cpp0x/override2.C: Add test. + 2011-10-21 Rainer Orth * lib/gcc-dg.exp (GCC_UNDER_TEST): Set before calling diff --git a/gcc/testsuite/g++.dg/cpp0x/override2.C b/gcc/testsuite/g++.dg/cpp0x/override2.C index 7f17504fae20..0d8871d6ae29 100644 --- a/gcc/testsuite/g++.dg/cpp0x/override2.C +++ b/gcc/testsuite/g++.dg/cpp0x/override2.C @@ -28,6 +28,13 @@ struct B6 final final {}; // { dg-error "duplicate virt-specifier" } struct B7 override {}; // { dg-error "cannot specify 'override' for a class" } +namespace N +{ + struct C; +} + +struct N::C final{}; + int main() { D3 d;