https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114129
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Theodore.Papadopoulo from comment #0) > Technically, it should be 'override' declared as function returning a > function. No, GCC is correct here, according to the grammar ... or as much as you can reason about how the grammar applies to code that doesn't conform to the grammar. The function declarator is `f() override` and the return type is `void()`. You get exactly the same error without the override: o.cc:6:5: error: âfâ declared as function returning a function 6 | void f()() { } | ^~~~ > or even maybe that override is a reserved name and cannot be used as a > function name... That would definitely be wrong though. It's not reserved, it's "an identifier with special meaning", and `void override() { }` is perfectly valid as a function declaration.