Fixed use-before-set in cpp
Added cpp doubley-nested test