c: Fix bug in typedef redefinitions of tagged types [PR118765]
When we redefine a tagged type we incorrectly update TYPE_STUB_DECL
of the previously defined type instead of the new one. Because
TYPE_STUB_DECL is used when determining whether two such types are
the same, this can cause valid typedef redefinitions to be rejected
later. This is only a partial fix for PR118765.
PR c/118765
gcc/c/ChangeLog:
* c-decl.cc (finish_struct,finish_enum): Swap direction when
copying TYPE_STRUB_DECL in redefinitions.
gcc/testsuite/ChangeLog:
* gcc.dg/pr118765.c: New test.