https://bugs.winehq.org/show_bug.cgi?id=47035
--- Comment #3 from Zebediah Figura z.figura12@gmail.com --- Generally I think we want to avoid duplicating types in widl, and just rely on pointer equality to test if a type was already written (to a typelib, header, eventually also NDR format string). This means getting rid of duptype(), which is only used in a couple places, but they're kind of tricky to get rid of. I think it'd be a matter of moving type qualifiers and specifiers out of the type structure itself and into the decl_spec stucture, and then propagating those upward a layer to the typedef, arg, declaration, etc.
The other option is that we don't rely on pointer equality to test if two types are equal, and instead do a deep comparison, i.e. along the lines of type_is_equal(). (Despite the comment in that function I'm not sure we'd need to do deep inspection in that case.) I'm a little lukewarm about this, though, inasmuch as it means we can't as easily store information like offset / whether the type was written in the type structure itself (i.e. we can, but every time we look it up we'd have to search the namespace for another type that was written, if this one wasn't.)