This very simple code:
#include
#include <string>
const boost::any getBoolVal()
{
return false;
}
int main()
{
boost::any vals[] = {1.0, std::string("1m"), getBoolVal()};
}
When built using Visual C++ 2010, it will run into a infinite loop:
ntdll.dll!_RtlAllocateHeap@12() + 0x8 bytes
ntdll.dll!_RtlDebugAllocateHeap@12() + 0x86 bytes
ntdll.dll!@RtlpAllocateHeap@20() + 0x1108a bytes
ntdll.dll!_RtlAllocateHeap@12() - 0x28d8a bytes
msvcr100d.dll!_heap_alloc_base(unsigned int size=44) Line 55 C
msvcr100d.dll!_heap_alloc_dbg_impl(unsigned int nSize=8, int nBlockUse=1,
const char * szFileName=0x00000000, int nLine=0, int *
errno_tmp=0x002a3280) Line 431 + 0x9 bytes C++
msvcr100d.dll!_nh_malloc_dbg_impl(unsigned int nSize=8, int nhFlag=0, int
nBlockUse=1, const char * szFileName=0x00000000, int nLine=0, int *
errno_tmp=0x002a3280) Line 239 + 0x19 bytes C++
msvcr100d.dll!_nh_malloc_dbg(unsigned int nSize=8, int nhFlag=0, int
nBlockUse=1, const char * szFileName=0x00000000, int nLine=0) Line 302 +
0x1d bytes C++
msvcr100d.dll!malloc(unsigned int nSize=8) Line 56 + 0x15 bytes C++
msvcr100d.dll!operator new(unsigned int size=8) Line 59 + 0x9 bytes C++
test.exe!boost::any::any(const boost::any &&
value={...}, void * __formal=0x00000000) Line 73 + 0x49 bytes C++
test.exe!boost::any::holder::holder
(const boost::any && value={...}) Line 177 C++
...
test.exe!boost::any::any(const boost::any &&
value={...}, void * __formal=0x00000000) Line 73 + 0x71 bytes C++
test.exe!boost::any::holder::holder(const boost::any &&
value={...}, void * __formal=0x00000000) Line 73 + 0x71 bytes C++
test.exe!boost::any::holder::holder(const boost::any &&
value={...}, void * __formal=0x00000000) Line 73 + 0x71 bytes C++
test.exe!boost::any::holder::holder(const boost::any &&
value={...}, void * __formal=0x00000000) Line 73 + 0x71 bytes C++
test.exe!main() Line 11 + 0x9c bytes C++
Sorry I don't know enough of the c++ standard to figure out whether it is
because of Visual C++ or it is because of boost. But I think it is worth to
raise it to the experts out here.
Thanks
Bo
----
http://www.pengbo.me