https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116728

--- Comment #5 from Martin Uecker <muecker at gwdg dot de> ---

Sorry, mixed this up with the other bug. Here I would say the behavior is
correct as specified in ISO C23.  Note that incomplete structs could be
completed later also before ISO C23. But incomplete struct types are
incompatible to other struct types with the same tag, and the incomplete struct
declared in prototype scope is therefor incompatible to the completed one.

If you have a forward declaration so that the struct in the function prototype
refers to a file scope version that is completed later, it works.

https://godbolt.org/z/qPKcvGevM


Of course, whether the languages are perfect as specified is a different
question. 

With "typedef" there is the additional issue that "typedef" currently allows
redefinition only for identical types, not merely compatible types.

Reply via email to