aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Voutilainen <ville.voutilainen@gmail.com>2012-06-20 04:18:08 +0300
committerJason Merrill <jason@gcc.gnu.org>2012-06-19 21:18:08 -0400
commit6830e502a29d90b4a38499624aa4518edc0123ea (patch)
tree0cf95f34bb8d460a68cf09692a4800fcd0d9999e
parent420bf978a74296ad1d2b31b9c3dc6551e9e55653 (diff)
downloadgcc-6830e502a29d90b4a38499624aa4518edc0123ea.zip
gcc-6830e502a29d90b4a38499624aa4518edc0123ea.tar.gz
gcc-6830e502a29d90b4a38499624aa4518edc0123ea.tar.bz2
parser.c (cp_parser_direct_declarator): Move virt-specifier parsing after late-specified return type parsing.
* parser.c (cp_parser_direct_declarator): Move virt-specifier parsing after late-specified return type parsing. From-SVN: r188808
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/parser.c5
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/override4.C45
4 files changed, 57 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 562f945..794b39f7 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-16 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ * parser.c (cp_parser_direct_declarator): Move virt-specifier
+ parsing after late-specified return type parsing.
+
2012-06-14 Jason Merrill <jason@redhat.com>
PR c++/53651
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 1691f81..6bc6877c 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -16102,12 +16102,13 @@ cp_parser_direct_declarator (cp_parser* parser,
/* And the exception-specification. */
exception_specification
= cp_parser_exception_specification_opt (parser);
- /* Parse the virt-specifier-seq. */
- virt_specifiers = cp_parser_virt_specifier_seq_opt (parser);
late_return = (cp_parser_late_return_type_opt
(parser, member_p ? cv_quals : -1));
+ /* Parse the virt-specifier-seq. */
+ virt_specifiers = cp_parser_virt_specifier_seq_opt (parser);
+
/* Create the function-declarator. */
declarator = make_call_declarator (declarator,
params,
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 07071a9..621ee96 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2012-06-16 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ * g++.dg/cpp0x/override4.C: New.
+
2012-06-14 Jason Merrill <jason@redhat.com>
PR c++/53651
diff --git a/gcc/testsuite/g++.dg/cpp0x/override4.C b/gcc/testsuite/g++.dg/cpp0x/override4.C
new file mode 100644
index 0000000..aec5c2c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/override4.C
@@ -0,0 +1,45 @@
+// { dg-options "-std=c++11" }
+// { dg-prune-output "expected ';'" }
+// { dg-prune-output "expected unqualified-id" }
+// { dg-prune-output "declaration does not declare anything" }
+
+struct B
+{
+ virtual auto f() -> void final;
+ virtual auto g() -> void;
+};
+
+struct B2
+{
+ virtual auto f() -> void final {}
+};
+
+struct B3
+{
+ virtual auto f() -> final void; // { dg-error "expected type-specifier" }
+};
+
+struct B4
+{
+ virtual auto f() -> final void {} // { dg-error "expected type-specifier" }
+};
+
+struct D : B
+{
+ virtual auto g() -> void override;
+};
+
+struct D2 : B
+{
+ virtual auto g() -> void override {}
+};
+
+struct D3 : B
+{
+ virtual auto g() -> override void; // { dg-error "expected type-specifier" }
+};
+
+struct D4 : B
+{
+ virtual auto g() -> override void {} // { dg-error "expected type-specifier" }
+};