diff mbox

[C++] PR 50811 (rejects class-virt-specifier if class-head-name includes nested-name-specifier)

Message ID 878vof89gd.wl%ville@ville-laptop
State New
Headers show

Commit Message

Ville Voutilainen Oct. 21, 2011, 12:38 a.m. UTC
Tested on X86-32 linux.

2011-10-21 Ville Voutilainen <ville.voutilainen@gmail.com>

           PR c++/50811
           * parser.c (cp_parser_class_head): Parse virt-specifiers regardless of whether an id is present

Comments

Jason Merrill Oct. 21, 2011, 1:31 p.m. UTC | #1
Applied, thanks.

Jason
diff mbox

Patch

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index ea0c4dc..dd2357b 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -17576,8 +17576,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/g++.dg/cpp0x/override2.C b/gcc/testsuite/g++.dg/cpp0x/override2.C
index 7f17504..0d8871d 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<B1> d;