From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6890 invoked by alias); 10 Oct 2004 08:56:04 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 6870 invoked by uid 48); 10 Oct 2004 08:56:03 -0000 Date: Sun, 10 Oct 2004 08:56:00 -0000 From: "mutz at kde dot org" To: gcc-bugs@gcc.gnu.org Message-ID: <20041010085558.17920.mutz@kde.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/17920] New: add __attribute__((reimpl)) as a replacement for the (optional) virtual keyword for reimplementations of virtual functions X-Bugzilla-Reason: CC X-SW-Source: 2004-10/txt/msg01290.txt.bz2 List-Id: The reason to have this is that quite often when overriding non-pure virtual methods, you will find yourself mistyping the signature of the reimplementation, which creates a new virtual method instead of overriding. The only indication of this happening is that you get hidden virtual warnings, but you also get them if there are overloads of the virtual method in the base class (as is often the case in the Qt library). What __attribute__((reimpl)) should do is emit an error or at least a warning if this happens: #define reimpl __attribute__((reimp)) struct A { virtual void foo() const; } struct B : public A { void reimpl foo(); } Warning: 'void foo()' does not override anything. Warning: candidates are: Warning: 'virtual A::foo() const' -- Summary: add __attribute__((reimpl)) as a replacement for the (optional) virtual keyword for reimplementations of virtual functions Product: gcc Version: 3.4.2 Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: mutz at kde dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17920