public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
[parent not found: <bug-17920-4@http.gcc.gnu.org/bugzilla/>]
* [Bug c++/17920] New: add __attribute__((reimpl)) as a replacement for the (optional) virtual keyword for reimplementations of virtual functions
@ 2004-10-10  8:56 mutz at kde dot org
  2004-10-10 14:20 ` [Bug c++/17920] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: mutz at kde dot org @ 2004-10-10  8:56 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-06-21 16:02 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-17920-5280@http.gcc.gnu.org/bugzilla/>
2008-08-21 18:45 ` [Bug c++/17920] add __attribute__((reimpl)) as a replacement for the (optional) virtual keyword for reimplementations of virtual functions thomas dot mcguire at gmx dot net
2008-08-21 19:06 ` pluto at agmk dot net
2008-08-21 19:16 ` thomas dot mcguire at gmx dot net
2008-11-30 15:47 ` Woebbeking at web dot de
2008-12-27 22:05 ` pinskia at gcc dot gnu dot org
2010-01-05 16:27 ` shcherbakov at daad-alumni dot de
2010-01-06 11:58 ` jwakely dot gcc at gmail dot com
     [not found] <bug-17920-4@http.gcc.gnu.org/bugzilla/>
2011-06-21 16:02 ` redi at gcc dot gnu.org
2004-10-10  8:56 [Bug c++/17920] New: " mutz at kde dot org
2004-10-10 14:20 ` [Bug c++/17920] " pinskia at gcc dot gnu dot org
2004-10-10 16:06 ` pinskia at gcc dot gnu dot org
2004-10-10 16:14 ` gdr at cs dot tamu dot edu
2004-10-10 22:41 ` giovannibajo at libero dot it
2004-10-10 22:46 ` gdr at cs dot tamu dot edu
2004-10-11  9:28 ` giovannibajo at libero dot it
2004-10-11 12:54 ` bangerth at dealii dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).