From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19548 invoked by alias); 7 Oct 2012 17:42:45 -0000 Received: (qmail 19488 invoked by uid 48); 7 Oct 2012 17:42:31 -0000 From: "ashish.sadanandan at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/54849] New: Override specifier with trailing return type Date: Sun, 07 Oct 2012 17:42:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ashish.sadanandan at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-10/txt/msg00609.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54849 Bug #: 54849 Summary: Override specifier with trailing return type Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: ashish.sadanandan@gmail.com struct Base { virtual auto f () const -> int = 0; }; struct Derived : public Base { virtual auto f () const -> int override { return 0; } }; int main() { Derived d; } The above fails to compile. Errors: error: expected ';' at end of member declaration error: 'override' does not name a type Both errors are reported for the definition of Derived::f. According to the standard, section 8.4.1 Function definitions have the form function-definition: attribute-specifier-seqopt decl-specifier-seqopt declarator virt-specifier-seqopt function-body The declarator in a function-definition shall have the form D1 ( parameter-declaration-clause ) cv-qualifier-seqopt ref-qualifieropt exception-specificationopt attribute-specifier-seqopt trailing-return-typeopt Since the declarator includes the trailing return type, I believe the above should compile. If the override specifier is moved before the -> the code does compile, but that doesn't jive with the standard.