This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/37862] New: Parenthesised indirection alters class member access
- From: "nickc at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Oct 2008 08:52:53 -0000
- Subject: [Bug c++/37862] New: Parenthesised indirection alters class member access
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hi Guys,
Compiling and then executing this program:
#include <stdio.h>
class A {
public:
virtual void get() { printf ("A\n"); }
};
class B:public A {
public:
virtual void get() { printf ("B\n"); }
};
class C:public B {
};
int main (void)
{
C c;
C* p = &c;
p->A::get();
(p->A::get)();
return 0;
}
Results in:
A
B
Being displayed, rather than:
A
A
As far as I can tell the parentheses around the class member access should not
change anything.
Cheers
Nick
--
Summary: Parenthesised indirection alters class member access
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: nickc at redhat dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37862