The translation unit includes errno.h, through which errno is already
defined as preprocessor macro, whose definition provokes the error.
In my case, with gcc (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1, the file:
#include <errno.h>
typedef int ERR_SEV;
typedef enum ERRNO_
{
x
}
ERRNO;
typedef struct LOG_ENTRY_
{
char * message;
ERRNO errno;
ERR_SEV severity;
}
LOG_ENTRY;
yields the similar error:
a.c:12:13: error: field ‘__errno_location’ declared as a function
ERRNO errno;
^
as result of:
# define errno (*__errno_location ())
within <bits/errno.h>, within <errno.h>. Without #include <errno.h>,
no error.
Unless you have made a typo in posting the disgnostic, this would suggest
that your <errno.h> imports the definition:
#define errno (*_errno ())
The solution is not to use errno as your field name.