diff options
| -rw-r--r-- | src/pugixml.cpp | 24 | ||||
| -rw-r--r-- | src/pugixml.hpp | 8 | ||||
| -rw-r--r-- | tests/helpers.hpp | 9 | 
3 files changed, 33 insertions, 8 deletions
| diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 774de6c..7a6e946 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -3419,9 +3419,13 @@ namespace pugi  	{  	} +    static void unspecified_bool_xml_attribute(xml_attribute***) +    { +    } +  	xml_attribute::operator xml_attribute::unspecified_bool_type() const  	{ -      	return _attr ? &xml_attribute::_attr : 0; +      	return _attr ? unspecified_bool_xml_attribute : 0;     	}     	bool xml_attribute::operator!() const @@ -3663,9 +3667,13 @@ namespace pugi  	{  	} +    static void unspecified_bool_xml_node(xml_node***) +    { +    } +  	xml_node::operator xml_node::unspecified_bool_type() const  	{ -      	return _root ? &xml_node::_root : 0; +      	return _root ? unspecified_bool_xml_node : 0;     	}     	bool xml_node::operator!() const @@ -9160,9 +9168,13 @@ namespace pugi  		return _attribute ? _node : _node.parent();  	} +    static void unspecified_bool_xpath_node(xpath_node***) +    { +    } +  	xpath_node::operator xpath_node::unspecified_bool_type() const  	{ -		return (_node || _attribute) ? &xpath_node::_node : 0; +		return (_node || _attribute) ? unspecified_bool_xpath_node : 0;  	}  	bool xpath_node::operator!() const @@ -9637,9 +9649,13 @@ namespace pugi  		return _result;  	} +    static void unspecified_bool_xpath_query(xpath_query***) +    { +    } +  	xpath_query::operator xpath_query::unspecified_bool_type() const  	{ -		return _impl ? &xpath_query::_impl : 0; +		return _impl ? unspecified_bool_xpath_query : 0;  	}  	bool xpath_query::operator!() const diff --git a/src/pugixml.hpp b/src/pugixml.hpp index 8e8f3e1..8fe34ec 100644 --- a/src/pugixml.hpp +++ b/src/pugixml.hpp @@ -273,7 +273,7 @@ namespace pugi  	private:  		xml_attribute_struct* _attr; -    	typedef xml_attribute_struct* xml_attribute::*unspecified_bool_type; +    	typedef void (*unspecified_bool_type)(xml_attribute***);  	public:          // Default constructor. Constructs an empty attribute. @@ -355,7 +355,7 @@ namespace pugi  	protected:  		xml_node_struct* _root; -    	typedef xml_node_struct* xml_node::*unspecified_bool_type; +    	typedef void (*unspecified_bool_type)(xml_node***);  	public:  		// Default constructor. Constructs an empty node. @@ -899,7 +899,7 @@ namespace pugi  		void* _impl;  		xpath_parse_result _result; -    	typedef void* xpath_query::*unspecified_bool_type; +    	typedef void (*unspecified_bool_type)(xpath_query***);  		// Non-copyable semantics  		xpath_query(const xpath_query&); @@ -977,7 +977,7 @@ namespace pugi  		xml_node _node;  		xml_attribute _attribute; -    	typedef xml_node xpath_node::*unspecified_bool_type; +    	typedef void (*unspecified_bool_type)(xpath_node***);  	public:  		// Default constructor; constructs empty XPath node diff --git a/tests/helpers.hpp b/tests/helpers.hpp index abe6626..172f231 100644 --- a/tests/helpers.hpp +++ b/tests/helpers.hpp @@ -13,8 +13,17 @@ template <typename T> static void generic_bool_ops_test(const T& obj)  	CHECK(obj);  	CHECK(!!obj); +#ifdef _MSC_VER +#   pragma warning(push) +#   pragma warning(disable: 4800) // forcing value to bool 'true' or 'false' (performance warning) - we really want to just cast to bool instead of !! +#endif +  	bool b1 = null, b2 = obj; +#ifdef _MSC_VER +#   pragma warning(pop) +#endif +  	CHECK(!b1);  	CHECK(b2); | 
