This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/4248: reinterpret_cast in template
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/4248: reinterpret_cast in template
- From: Volker dot Denkhaus at softwareag dot com
- Date: 6 Sep 2001 14:21:26 -0000
- Reply-To: Volker dot Denkhaus at softwareag dot com
>Number: 4248
>Category: c++
>Synopsis: reinterpret_cast in template
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Sep 06 07:26:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Volker Denkhaus
>Release: gcc 2.95.3
>Organization:
>Environment:
Suse 7.1 DCOM
>Description:
Hi,
I have a problem with a method call after a reinterpret_cats in a template class.
This is the code:
template <class Base>
class CComTearOffObject : public Base
{
public:
CComTearOffObject(void* pv)
{
ATLASSERT(m_pOwner == NULL);
this->m_pOwner = reinterpret_cast<CComObject<typename Base::_OwnerClass>*>(p
v);
this->m_pOwner->AddRef();
}
The AddRef call ends up in a segmentation fault. In the debugger I can see that the address of the function AddRef which can be found in the vtable is calculated wrong.
Has anyone ever had a similar problem? Or is something wrong with the cast?
Volker Denkhaus
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: