Add metaprogramming for more precise overflow checks in assignment

The latest svn clang has much more precise warnings about
redundant comparisons, so excluding them via template metaprogramming
removes those warnings too.
Some fixes for clang warnings
Fixes for building with clang
Fix bug found by valgrind