The compiler can separate structure tags (also unions and enumerations) because they follow the keywords struct / union / enum , respectively (C11 §6.2.3p1).
Then the declarations must be unique within the "namespace" according to §6.7p3.
Since the structure tags and function identifiers (which are regular identifiers) are not in the same namespace, the collision is fine.
When it comes to use, you cannot do:
typedef struct _test { int a; } test; void test(void) { }
The compiler will tell you:
test.c:5:6: error: 'test' redeclared as different kind of symbol void test(void) { ^ test.c:3:3: note: previous declaration of 'test' was here } test;
source share