In Sema::LookupTemplateName(...) seeks to assert that the ObjectType is complete or being defined. If the type is incomplete it will attempt to unconditionally cast it to a TagType and not all incomplete types are a TagType. For example the type could be void or it could be an IncompleteArray.
This change adds an additional check to confirm it is a TagType before attempting to check if it is incomplete or being defined.
Slight preference for making the getAs happen after the completeness check, since that is in the 'order of costliness'.
Also, not sure the assert message here makes any sense, but I don't know of anything better here.