This fails to compile on my computer.
Turned out to be compiler error.  Commented out windows.h include, due to compiler incompatibility, and fixed toBoolean()/toInt() to throw the proper error.