https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108578
Bug ID: 108578
Summary: typedef inside a struct error message should be
improved
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
struct f {
typedef int t;
};
```
Currently the C front-end (it is valid C++) gives:
```
<source>:2:3: error: expected specifier-qualifier-list before 'typedef'
2 | typedef int t;
| ^~~~~~~
```
This error message is correct but the C front-end could mention that something
like typedefs inside the struct scope is not allowed.
clang gives slightly better error message:
```
<source>:2:3: error: type name does not allow storage class to be specified
typedef int t;
^
```
replacing typedef with static gives the same bad error mesage.