diff --git a/tccgen.c b/tccgen.c
index 3726109..d7f20df 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -4503,10 +4503,21 @@ static int post_type(CType *type, AttributeDef *ad, int storage, int td)
         skip(']');
         /* parse next post type */
         post_type(type, ad, storage, 0);
-        if (type->t == VT_FUNC)
-            tcc_error("declaration of an array of functions");
+
+        /* reject incomplete element types */
+        switch (type->t & VT_BTYPE) {
+        case VT_ENUM: // fall through
+        case VT_STRUCT: // fall through
+        case VT_UNION: // fall through
+            if (type->ref->c >= 0) break;
+            // fall through
+        case VT_FUNC: // fall through
+        case VT_VOID: // fall through
+            tcc_error("array of elements of incomplete type");
+        }
+
         t1 |= type->t & VT_VLA;
-        
+
         if (t1 & VT_VLA) {
             if (n < 0)
               tcc_error("need explicit inner array size in VLAs");
