deletion of pointer to incomplete type 'decaf::lang::ThreadProperties'; no
destructor called
--------------------------------------------------------------------------------------------
Key: AMQCPP-282
URL: https://issues.apache.org/activemq/browse/AMQCPP-282
Project: ActiveMQ C++ Client
Issue Type: Bug
Affects Versions: 3.1
Environment: Visual Studio 2008 SP1 on Win32 (Windows Server 2003 R2,
32-bit)
Reporter: Ivan Pechorin
Assignee: Timothy Bish
ActiveMQ C++ client gives the C4150 warning "deletion of pointer to incomplete
type; no destructor called" multiple times when compiling it with Visual C++
2008 SP1 on Win32.
There are two different places that generate this warning:
1) decaf::lang::ThreadProperties
1>SimpleLogger.cpp
1>c:\dev_vc9\activemq\activemq-cpp-trunk\src\main\decaf/lang/Pointer.h(358) :
warning C4150: deletion of pointer to incomplete type
'decaf::lang::ThreadProperties'; no destructor called
1>
c:\dev_vc9\activemq\activemq-cpp-trunk\src\main\decaf/lang/Thread.h(39) : see
declaration of 'decaf::lang::ThreadProperties'
1>
c:\dev_vc9\activemq\activemq-cpp-trunk\src\main\decaf/lang/Pointer.h(357) :
while compiling class template member function 'void
decaf::lang::Pointer<T>::onDeleteFunc(T *)'
1> with
1> [
1> T=decaf::lang::ThreadProperties
1> ]
1>
c:\dev_vc9\activemq\activemq-cpp-trunk\src\main\decaf/lang/Thread.h(73) : see
reference to class template instantiation 'decaf::lang::Pointer<T>' being
compiled
1> with
1> [
1> T=decaf::lang::ThreadProperties
1> ]
2) decaf::internal::RuntimeData
1>Thread.cpp
1>C:\tools\Microsoft Visual Studio 9.0\VC\include\memory(721) : warning C4150:
deletion of pointer to incomplete type 'decaf::internal::RuntimeData'; no
destructor called
1>
c:\dev_vc9\activemq\activemq-cpp-trunk\src\main\decaf/internal/DecafRuntime.h(30)
: see declaration of 'decaf::internal::RuntimeData'
1> C:\tools\Microsoft Visual Studio 9.0\VC\include\memory(720) : while
compiling class template member function 'std::auto_ptr<_Ty>::~auto_ptr(void)'
1> with
1> [
1> _Ty=decaf::internal::RuntimeData
1> ]
1>
c:\dev_vc9\activemq\activemq-cpp-trunk\src\main\decaf/internal/DecafRuntime.h(38)
: see reference to class template instantiation 'std::auto_ptr<_Ty>' being
compiled
1> with
1> [
1> _Ty=decaf::internal::RuntimeData
1> ]
The warning affects both version 3.1.0 and the trunk.
I was able to resolve the warning by moving declarations of these two classes
from the cpp files to the corresponding header files. I'm not proficient enough
in C++ to provide solution that keeps these classes encapsulated.
It is unlikely that these two particular warnings could lead to memory leaks on
Win32:
- RuntimeData's only member is managed from outside, destructor is trivial
(empty);
- ThreadProperties's destructor is trivial (empty) on Win32, and non-trivial
on platforms with pthreads.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.