c++/4248: reinterpret_cast in template
Volker.Denkhaus@softwareag.com
Volker.Denkhaus@softwareag.com
Thu Sep 6 07:26:00 GMT 2001
>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:
More information about the Gcc-bugs
mailing list