aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--decl.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/decl.c b/decl.c
index cff7564..5a8712b 100644
--- a/decl.c
+++ b/decl.c
@@ -162,17 +162,14 @@ tagspec(struct scope *s)
default: fatal("internal error: unknown tag kind");
}
next();
- if (tok.kind == TIDENT) {
- tag = tok.lit;
- next();
+ if (tok.kind == TLBRACE) {
+ tag = NULL;
+ t = NULL;
+ } else {
+ tag = expect(TIDENT, "or '{' after struct/union");
t = scopegettag(s, tag, false);
if (s->parent && !t && tok.kind != TLBRACE && (kind == TYPEENUM || tok.kind != TSEMICOLON))
t = scopegettag(s->parent, tag, true);
- } else if (tok.kind != TLBRACE) {
- error(&tok.loc, "expected identifier or '{' after struct/union");
- } else {
- tag = NULL;
- t = NULL;
}
if (t) {
if (t->kind != kind)