falcong / pugixml

Automatically exported from code.google.com/p/pugixml
0 stars 0 forks source link

(MSVS2008) safe bool conversion operator return 0xFFFFFFFF for a null handle when compiled with /clr #121

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

compile with /clr

What is the expected output? What do you see instead?

operator unspecified_bool_type() const; 
will return 0xFFFFFFFF instead of 0 when internal pointer is null

Which version of pugixml are you using? On what operating system/compiler?

pugixml v1.0
win 7
Visual Studio 2008 Pro

Please provide any additional information below.

discussion at: 
http://boost.2283326.n4.nabble.com/Problem-with-shared-ptr-in-MSVC8-0-only-when-
compiled-in-clr-mode-td2606055.html

workaround:

static void unspecified_bool( xml_node*** ) {} 
typedef void (*unspecified_bool_type)( xml_node*** ); 

xml_node::operator xml_node::unspecified_bool_type() const
{
   return _root ? unspecified_bool : 0;
}

Original issue reported on code.google.com by bmat...@gmail.com on 12 Aug 2011 at 3:47

GoogleCodeExporter commented 9 years ago
Thank you for the bug report! This is now fixed in trunk.

Original comment by arseny.k...@gmail.com on 19 Aug 2011 at 3:38