| Submitter | ville |
|---|---|
| Date | June 16, 2012, 6:39 p.m. |
| Message ID | <87fw9vxfr6.wl%ville@ville-laptop> |
| Download | mbox | patch |
| Permalink | /patch/165312/ |
| State | New |
| Headers | show |
Comments
Applied, thanks. Note that your dg-error regexp doesn't make much sense:
// { dg-error "expected type-specifier before 'final'||expected
';'||declaration doesn't declare anything" }
Regular expression "or" uses a single |, so this ends up being a long
way of writing
// { dg-error "" }
I adjusted the dg-error lines to check only for the "expected
type-specifier" error, and used dg-prune-output to discard the extra errors.
Jason
On 20 June 2012 10:35, Jason Merrill <jason@redhat.com> wrote: > Applied, thanks. Note that your dg-error regexp doesn't make much sense: > > > // { dg-error "expected type-specifier before 'final'||expected > ';'||declaration doesn't declare anything" } > > Regular expression "or" uses a single |, so this ends up being a long way of > writing > > // { dg-error "" } Funny. The testcasewriting gcc wiki page at http://gcc.gnu.org/wiki/TestCaseWriting suggests a double pipe. Quoth the Raven: Should a line produce two errors, the regular expression should include an "||" (ie. a regular expression OR) between the possible message fragments. If a single pipe is indeed to be used, perhaps we want to correct that piece of documentation, lest fools follow its advice. :)
On 06/20/2012 12:57 AM, Ville Voutilainen wrote: > If a single pipe is indeed to be used, perhaps we want to correct that > piece of documentation, lest fools follow its advice. :) Done, thanks. Jason
Patch
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 1691f81..6bc6877 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,
2012-06-16 Ville Voutilainen <ville.voutilainen@gmail.com> Parse virt-specifiers after late-specified return types. * parser.c (cp_parser_direct_declarator): Move virt-specifier parsing after late-specified return type parsing * override4.C: new Git is doing weird things with my test, its diff shows a stale file version. Attached here inline: --snip-- // { dg-do compile } // { dg-options "--std=c++11" } 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 before 'final'||expected ';'||declaration doesn't declare anything" } }; struct B4 { virtual auto f() -> final void {} // { dg-error "expected type-specifier before 'final'||expected ';'||declaration doesn't declare anything" } }; 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 before 'override'||expected ';'||declaration doesn't declare anything" } }; struct D4 : B { virtual auto g() -> override void {} // { dg-error "expected type-specifier before 'override'||expected ';'||declaration doesn't declare anything" } }; int main() { } --snap-- And the patch: