diff --git a/tccgen.c b/tccgen.c
index e640e78b..29dae91e 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -7996,6 +7996,11 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r,
        toplevel array or the last member of the toplevel struct */
 
     if (size < 0) {
+        // error out except for top-level incomplete arrays
+        // (arrays of incomplete types are handled in array parsing)
+        if (!(type->t & VT_ARRAY))
+            tcc_error("initialization of incomplete type");
+
         /* If the base type itself was an array type of unspecified size
            (like in 'typedef int arr[]; arr x = {1};') then we will
            overwrite the unknown size by the real one for this decl.
diff --git a/tests/tests2/60_errors_and_warnings.c b/tests/tests2/60_errors_and_warnings.c
index 960c64f5..6513ee1b 100644
--- a/tests/tests2/60_errors_and_warnings.c
+++ b/tests/tests2/60_errors_and_warnings.c
@@ -463,4 +463,17 @@ int main() {
 #error \123\\
 456
 
+#elif defined test_error_incomplete_type
+struct A;
+void f(struct A *);
+
+int main()
+{
+    f(&(struct A){});
+}
+
+struct A {
+    int x;
+};
+
 #endif
diff --git a/tests/tests2/60_errors_and_warnings.expect b/tests/tests2/60_errors_and_warnings.expect
index 9a95e93e..25a76245 100644
--- a/tests/tests2/60_errors_and_warnings.expect
+++ b/tests/tests2/60_errors_and_warnings.expect
@@ -23,7 +23,7 @@
 [returns 1]
 
 [test_61_undefined_enum]
-60_errors_and_warnings.c:46: error: unknown type size
+60_errors_and_warnings.c:46: error: initialization of incomplete type
 
 [test_74_non_const_init]
 60_errors_and_warnings.c:49: error: initializer element is not constant
@@ -228,3 +228,6 @@ arg[1] = "Y"
 
 [test_error_string]
 60_errors_and_warnings.c:464: error: #error \123\456
+
+[test_error_incomplete_type]
+60_errors_and_warnings.c:472: error: initialization of incomplete type