added unit test (and allanlw's fix) for c++ template class instruction