This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/6373: Reimplementation of virtual functions in the same class works (should normally not)gcc version 2.95.3 20010315 (SuSE)



>Number:         6373
>Category:       c++
>Synopsis:       Reimplementation of virtual functions in the same class works (should normally not)gcc version 2.95.3 20010315 (SuSE)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 19 06:26:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Andreas Pietzowski
>Release:        gcc version 2.95.3 20010315 (SuSE)
>Organization:
>Environment:
SuSE-Linux 8.0
>Description:
Hi,

I program code for KDE with Qt under Linux. Qt has e.g a class QTable and in there they implemented this method

virtual void QTable::activateNextCell(){
  // some code here
}

Now it is possible that I write in my code:

void QTable::activateNextCell(){
  // some other code
}

and my reimplementation compiles and is used by the executable. Under Windows with Borlans bcc it isn't used.

The guys from Trolltech (the founders of Qt) told me I should report this behaviour to you because a compiler should never allow a reimplementation of a method of the same class (only if you create a sub-class).

Could you follow me? Was it enough info? If not please contact me via email and I'll try to explain it more detailed.
>How-To-Repeat:

>Fix:
A warning would be enough I think because the behavior of a compiler is not defined in that case I think. And prehaps don't use the reimplemented code because there is already an original implementation.
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]