https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91760
Bug ID: 91760 Summary: Trailing return type breaks final specifier Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: john.boyer at tutanota dot com Target Milestone: --- The following code: struct final; struct test { virtual auto foo() -> int final; }; Generates this error: error: two or more data types in declaration of 'type name' Example: https://godbolt.org/z/4GSoW_ The same code works fine on clang (https://godbolt.org/z/4d3J85), MSVC (https://godbolt.org/z/BYq2yW) and ICC (https://godbolt.org/z/_V9Qvd). Since final and override are "identifiers with special meaning", this code should compile as there is no ambiguity on whether or not "final" can be an identifier in this context. If the trailing return type is changed to a normal return type, this of course will compile as expected (https://godbolt.org/z/ReWHag): struct final; struct test { virtual int foo() final; };