keep an aggregate written in place behind a pointer
A type was flattened word by word, a struct's body included, so
(* (struct ((c int)))) came out struct c{ int; } *.
This commit is contained in:
@@ -848,6 +848,18 @@ whitespace aside, THEN?"
|
||||
(test-assert "and negation beside a binary operator"
|
||||
(emits? (in-fn "(var n int (+ (- a) b))") "-a + b")))
|
||||
|
||||
;; A type was flattened word by word, a struct written out in it
|
||||
;; included: (* (struct ((c int)))) came out `struct c{ int; } *'
|
||||
(test-group "a pointer to an aggregate written in place"
|
||||
(test-assert "keeps its fields"
|
||||
(followed-by? "(struct h ((b (* (struct ((c int)))))))" "int c;" "} * b;"))
|
||||
(test-assert "a pointer among them as well"
|
||||
(emits? "(struct h ((b (* (struct ((p (* int)) (n int)))))))" "int * p;"))
|
||||
(test-assert "and a qualifier before it"
|
||||
(emits? "(struct h ((e (* const (union ((u int) (v float)))))))" "const union{"))
|
||||
(test-assert "behind as many stars as are written"
|
||||
(emits? "(struct h ((f (* * (struct ((c int)))))))" "} * * f;")))
|
||||
|
||||
;; 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"
|
||||
|
||||
Reference in New Issue
Block a user