diff options
author | Michael Forney <mforney@mforney.org> | 2021-12-06 13:58:50 -0800 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2021-12-06 13:59:11 -0800 |
commit | aefb830ede6316f5fcf4c3c48b79a661c66c9f2e (patch) | |
tree | 0353766f49e74d60124d2d50ebf8216a8958bed1 | |
parent | 673a92cead5dbc453a2234baffafb250cc1f41b6 (diff) |
decl: Fix typedefs with type qualifiers
Previously, the qualifiers were saved, but accidentally ignored
when the typedef was referenced.
-rw-r--r-- | decl.c | 1 | ||||
-rw-r--r-- | test/typedef-qual.c | 3 | ||||
-rw-r--r-- | test/typedef-qual.qbe | 1 |
3 files changed, 5 insertions, 0 deletions
@@ -349,6 +349,7 @@ declspecs(struct scope *s, enum storageclass *sc, enum funcspec *fs, int *align) if (!d || d->kind != DECLTYPE) goto done; t = d->type; + tq |= d->qual; ++ntypes; next(); break; diff --git a/test/typedef-qual.c b/test/typedef-qual.c new file mode 100644 index 0000000..b027dab --- /dev/null +++ b/test/typedef-qual.c @@ -0,0 +1,3 @@ +typedef const int T; +const int x; +T x; diff --git a/test/typedef-qual.qbe b/test/typedef-qual.qbe new file mode 100644 index 0000000..7cf0e40 --- /dev/null +++ b/test/typedef-qual.qbe @@ -0,0 +1 @@ +export data $x = align 4 { z 4 } |