public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55385] New: g++ failed to call final overrider of a virtual function.
@ 2012-11-19 0:57 meng at g dot clemson.edu
2012-11-19 19:17 ` [Bug c++/55385] " daniel.kruegler at googlemail dot com
2021-08-02 0:15 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: meng at g dot clemson.edu @ 2012-11-19 0:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55385
Bug #: 55385
Summary: g++ failed to call final overrider of a virtual
function.
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: meng@g.clemson.edu
The code below is adapted from the example code given in 10.3/2 of the current
standard.
--------------- BEGIN ---------------
#include <iostream>
struct A {
virtual void f() { std::cout << "A::f" << std::endl; }
};
struct B : virtual A {
virtual void f() { std::cout << "B::f" << std::endl; }
};
struct C : B , virtual A {
using A::f;
};
void foo() {
C c;
c.f(); // (1) calls B::f, the final overrider
c.C::f(); // (2) calls A::f because of the using-declaration
}
int main ()
{
foo();
return 0;
}
--------------- END ---------------
The standard says that c.f() should call B::f because it is the final overrider
in C of the virtual function f. According to my test on g++-4.7.0, however,
both call A::f.
My compile command line is: ~/gcc/4.7.0/bin/c++ -O3 -Wall -Wextra t.cc
My compiler version is:
Reading specs from /home/meng/gcc/4.7.0/lib/gcc/i686-pc-linux-gnu/4.7.0/specs
COLLECT_GCC=/home/meng/gcc/4.7.0/bin/c++
COLLECT_LTO_WRAPPER=/home/meng/gcc/4.7.0/libexec/gcc/i686-pc-linux-gnu/4.7.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ./configure --prefix=/home/meng/gcc/4.7.0/
--enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 (GCC)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-02 0:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-19 0:57 [Bug c++/55385] New: g++ failed to call final overrider of a virtual function meng at g dot clemson.edu
2012-11-19 19:17 ` [Bug c++/55385] " daniel.kruegler at googlemail dot com
2021-08-02 0:15 ` pinskia at gcc dot gnu.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).