This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/84581] GCC expects "override" keyword in incorrect grammar position
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 27 Feb 2018 00:45:19 +0000
- Subject: [Bug c++/84581] GCC expects "override" keyword in incorrect grammar position
- Auto-submitted: auto-generated
- References: <bug-84581-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84581
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-02-27
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=64794
Ever confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:
struct Base {
virtual const char (&GetBuffer() const)[1] = 0;
};
struct Wrong : Base {
// GCC requires this incorrect syntax...
virtual const char (&GetBuffer() const override)[1];
};
struct Correct : Base {
// ...but the below is the correct syntax, which GCC rejects.
virtual const char (&GetBuffer() const)[1] override;
};
This gives:
o.cc:11:46: error: expected ‘;’ at end of member declaration
virtual const char (&GetBuffer() const)[1] override;
^
;
o.cc:11:48: error: ‘override’ does not name a type
virtual const char (&GetBuffer() const)[1] override;
^~~~~~~~
EDG behaves the same as G++ but Clang gets it right.