anthropics / anthropics/claudes-c-compiler
Parser error for function pointers to functions returning function pointers in parameter lists
- Langage dominant
- Rust
- Étoiles
- 2.8k
- Forks
- 247
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
The compiler fails to parse a valid C function declaration when the parameter list contains a pointer to a function that returns another function pointer.
**Minimal reproducible example:**
```
void f(void (*(*p)())());
int main() {
return 0;
}
```
**Observed Behavior:**
This code compiles correctly with gcc, but ccc outputs the following errors:
```
fptrs.c:1:19: error: expected ')' before '('
void f(void (*(*p)())());
^
fptrs.c:1:24: error: expected ';' after declaration before ')'
void f(void (*(*p)())());
^
fix-it hint: insert ';'
fptrs.c:1:24: error: expected declaration before ')'
void f(void (*(*p)())());
^
ccc: error: fptrs.c: 3 parse error(s)
```
**Expected Behavior:**
The compiler should recognize `void (*(*p)())()` as a valid parameter declaration (a pointer `p` to a function returning a pointer to a function returning void) and compile without errors.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.