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
* [Bug c++/55385] g++ failed to call final overrider of a virtual function.
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 ` daniel.kruegler at googlemail dot com
2021-08-02 0:15 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-11-19 19:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55385
Daniel Krügler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler at
| |googlemail dot com
--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-11-19 19:16:43 UTC ---
I can see the exact same behaviour in gcc 4.8.0 20121104 (experimental).
I agree that the current behaviour looks like a defect defect and my tentative
guess is that this might be due to
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#608
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/55385] g++ failed to call final overrider of a virtual function.
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
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-02 0:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55385
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is an exact dup of bug 11750 which has been fixed since GCC 4.8; in fact a
few days before this bug was filed, Nov 14, 2012 :).
*** This bug has been marked as a duplicate of bug 11750 ***
^ 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).