diff options
author | Michael Forney <mforney@mforney.org> | 2019-02-13 18:34:41 -0800 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2019-02-13 19:42:25 -0800 |
commit | 0dd40e7482785238968dc2c9a36bc2bfd7896df4 (patch) | |
tree | 143f49eb959b906e5acc83ea48d20d32916c7ac3 /expr.c | |
parent | a080e36dac54b82beef63580f36cb0da9ad31788 (diff) |
Fix decay on qualified array types
Diffstat (limited to 'expr.c')
-rw-r--r-- | expr.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -53,15 +53,21 @@ static struct expression * decay(struct expression *e) { struct expression *old = e; + struct type *t; + enum typequalifier tq = QUALNONE; - switch (e->type->kind) { + // XXX: combine with decl.c:adjust in some way? + t = typeunqual(e->type, &tq); + switch (t->kind) { case TYPEARRAY: - e = mkexpr(EXPRUNARY, mkpointertype(old->type->base), EXPRFLAG_DECAYED); + t = mkqualifiedtype(mkpointertype(old->type->base), tq); + e = mkexpr(EXPRUNARY, t, EXPRFLAG_DECAYED); e->unary.op = TBAND; e->unary.base = old; break; case TYPEFUNC: - e = mkexpr(EXPRUNARY, mkpointertype(old->type), EXPRFLAG_DECAYED); + t = mkpointertype(old->type); + e = mkexpr(EXPRUNARY, t, EXPRFLAG_DECAYED); e->unary.op = TBAND; e->unary.base = old; break; |