vickenty / lang-c

Lightweight C parser for Rust
Apache License 2.0
202 stars 30 forks source link

Parse error in struct typedef #35

Closed theduke closed 2 years ago

theduke commented 2 years ago
typedef struct mi_heap_area_s {
  size_t x;
} mi_heap_area_t;

==> unexpected token at line 9 column 3, expected '<typedef_name>', '}'

Notice also the wrong line number!

Curiously, this works:

typedef struct mi_heap_area_s {
  void* x;
} mi_heap_area_t;
vickenty commented 2 years ago

Thanks for the report!

The parse error should be fixed by 3c8d0f489f2ad9453144a915ad5f92aac2320fce.

Line numbers are a known issue: they correspond to the source after preprocessor expansion, rather than the original input, so not very helpful.