Fix li_boost_intrusive_ptr for various versions of boost

Modify testcase to fix compile errors on various versions of boost.
Tested using various combinations from boost-1.33/gcc-3.4.2 to
boost-1.53/gcc-4.7.3. Originally noticed as broken on
boost-1.36/gcc-4.3.4 on SLE 11.

Add in some diagnostics when reference count is wrong... which does
still happen occasionally.