Ticket #5506: Don't crash upon invalid template declaration

Hi,

This patch fixes the ticket by properly skipping template parameters in TemplateSimplifier::getTemplateDeclarations, so that we don't believe we're seeing a declaration for invalid code with a ; in the parameters. Thanks to consider merging.

Best regards,
  Simon