&& TREE_CODE (vistype) == TREE_CODE (t)
&& !C_TYPE_BEING_DEFINED (vistype))
{
- TYPE_STUB_DECL (vistype) = TYPE_STUB_DECL (t);
+ TYPE_STUB_DECL (t) = TYPE_STUB_DECL (vistype);
if (c_type_variably_modified_p (t))
{
error ("redefinition of struct or union %qT with variably "
&& TREE_CODE (vistype) == TREE_CODE (enumtype)
&& !C_TYPE_BEING_DEFINED (vistype))
{
- TYPE_STUB_DECL (vistype) = TYPE_STUB_DECL (enumtype);
+ TYPE_STUB_DECL (enumtype) = TYPE_STUB_DECL (vistype);
if (!comptypes_same_p (enumtype, vistype))
error("conflicting redefinition of enum %qT", enumtype);
}
--- /dev/null
+/* { dg-do "compile" } */
+/* { dg-options "-std=gnu23" } */
+
+typedef struct q { int x; } q_t;
+struct q { int x; };
+typedef struct q { int x; } q_t;
+