aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2024-04-06 13:37:21 -0700
committerMichael Forney <mforney@mforney.org>2024-04-06 13:44:37 -0700
commitb7098ab7d4b48a79247679ae8d7e28a7f3bb0910 (patch)
treeabb1a788338f85def7058c636129af327651b89c
parent177b1f4ba2780db1073654b5fdd39480492dab1b (diff)
expr: Check that _Generic association type has complete object type
-rw-r--r--expr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/expr.c b/expr.c
index 5f5990e..e1cd271 100644
--- a/expr.c
+++ b/expr.c
@@ -598,6 +598,10 @@ generic(struct scope *s)
t = typename(s, &qual);
if (!t)
error(&tok.loc, "expected typename for generic association");
+ if (t->kind == TYPEFUNC)
+ error(&tok.loc, "generic association must have object type");
+ if (t->incomplete)
+ error(&tok.loc, "generic association must have complete type");
expect(TCOLON, "after type name");
e = assignexpr(s);
if (typecompatible(t, want) && qual == QUALNONE) {