mirror of https://github.com/rui314/chibicc.git
Do not allow to obtain an address of a bitfield
This commit is contained in:
parent
17ea802cea
commit
c302a969d8
9
parse.c
9
parse.c
|
@ -2003,8 +2003,13 @@ static Node *unary(Token **rest, Token *tok) {
|
|||
if (equal(tok, "-"))
|
||||
return new_unary(ND_NEG, cast(rest, tok->next), tok);
|
||||
|
||||
if (equal(tok, "&"))
|
||||
return new_unary(ND_ADDR, cast(rest, tok->next), tok);
|
||||
if (equal(tok, "&")) {
|
||||
Node *lhs = cast(rest, tok->next);
|
||||
add_type(lhs);
|
||||
if (lhs->kind == ND_MEMBER && lhs->member->is_bitfield)
|
||||
error_tok(tok, "cannot take address of bitfield");
|
||||
return new_unary(ND_ADDR, lhs, tok);
|
||||
}
|
||||
|
||||
if (equal(tok, "*")) {
|
||||
// [https://www.sigbus.info/n1570#6.5.3.2p4] This is an oddity
|
||||
|
|
Loading…
Reference in New Issue