]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/50811 ([C++0x] G++ rejects class-virt-specifier if class-head-name includes...
authorVille Voutilainen <ville.voutilainen@gmail.com>
Fri, 21 Oct 2011 13:31:21 +0000 (16:31 +0300)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 21 Oct 2011 13:31:21 +0000 (09:31 -0400)
PR c++/50811
* parser.c (cp_parser_class_head): Parse virt-specifiers
regardless of whether an id is present

From-SVN: r180301

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/override2.C

index df7e1bcf05c1b0c680747fc44a2ed3fb534155b7..11994ee4b13e8f9624861275e3e95d7692190122 100644 (file)
@@ -1,3 +1,9 @@
+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
+
 2011-10-20  Jason Merrill  <jason@redhat.com>
 
        PR c++/41449
index 8d138fb7b5388e9f07d9ab2c0b8b92752fd683c4..a762d9d91847aafa43558f16be1bba65e7e52382 100644 (file)
@@ -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
index b70d758b6b0c7ee6f47f90b4a652de44a10a04b7..a1b2752c45f4872abd5783aaf56ae5b30eb0f377 100644 (file)
@@ -1,3 +1,8 @@
+2011-10-21  Ville Voutilainen  <ville.voutilainen@gmail.com>
+
+       PR c++/50811
+       * g++.dg/cpp0x/override2.C: Add test.
+
 2011-10-21  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * lib/gcc-dg.exp (GCC_UNDER_TEST): Set before calling
index 7f17504fae20d34dd85e701a6eff555bec6a4350..0d8871d6ae29eccace6aae9fa03c8e79fea56003 100644 (file)
@@ -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;