write every star of a pointer chain to a struct

c-struct/aux wrote the tag and the first * after it and dropped the
rest, so (* * struct pt) declared a struct pt *.
This commit is contained in:
2026-10-16 15:25:29 +03:00
parent f42cff460f
commit ba26e4e828
2 changed files with 12 additions and 1 deletions

View File

@@ -752,6 +752,14 @@ whitespace aside, THEN?"
(test-assert "and negation beside a binary operator"
(emits? (in-fn "(var n int (+ (- a) b))") "-a + b")))
;; c-struct/aux wrote the tag and the first `*' after it, and
;; dropped the rest of the chain
(test-group "a pointer chain to a struct"
(test-assert "keeps every star"
(emits? (in-fn "(var q (* * struct p))") "struct p* * q;"))
(test-assert "and every qualifier between them"
(emits? (in-fn "(var q (* const * union u))") "union u* const * q;")))
;; An array bound was taken only when it was an integer literal, so a
;; symbolic one fell into the type: `[int N]' came out `int N a[]'.
(test-group "array bounds"