This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/37473] New: typedef results in wrong function call linkage
- From: "amodra at bigpond dot net dot au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Sep 2008 02:43:03 -0000
- Subject: [Bug c++/37473] New: typedef results in wrong function call linkage
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following testcase compiled with -O -fPIC results in a non-PLT call to
A::check. On x86_64 that means an R_X86_64_PC32 reloc, which the linker later
correctly complains about if we are building a shared library. Curiously, if
either or both of the typedefs are removed, you get the code I'd expect.
typedef struct
{
int check ();
} A;
typedef struct
{
A a;
int validate ();
private:
int check ();
} B;
int
B::check ()
{
return a.check ();
}
int
B::validate ()
{
return check ();
}
int
doit ()
{
B b;
return b.validate ();
}
--
Summary: typedef results in wrong function call linkage
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: amodra at bigpond dot net dot au
GCC target triplet: x86_64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37473