Actual fix for #1660

Set the warning type id correctly or not at all. But in any case do not
set the type id = thread id.

See this post for details: