From b7098ab7d4b48a79247679ae8d7e28a7f3bb0910 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sat, 6 Apr 2024 13:37:21 -0700 Subject: expr: Check that _Generic association type has complete object type --- expr.c | 4 ++++ 1 file changed, 4 insertions(+) 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) { -- cgit v1.2.3