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; };
Confirmed.
override has the same issue, see PR 64794.