gen: fix some corner-cases in forward declaration generation

 - don't generate forward declarations for opaques that are
   actually typedefs. It collides with the actual type definition
 - when getting an array type, generate the forward declaration for
   the element type, not the array
gen: add some missing template class instanciations in TemplateInstanciation.cpp