File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -489,13 +489,32 @@ void c_typecheck_baset::typecheck_array_type(array_typet &type)
489
489
typecheck_type (type.subtype ());
490
490
491
491
// we don't allow void as subtype
492
- if (follow ( type.subtype () ).id ()==ID_empty)
492
+ if (type.subtype ().id ()==ID_empty)
493
493
{
494
494
error ().source_location =type.source_location ();
495
495
error () << " array of voids" << eom;
496
496
throw 0 ;
497
497
}
498
498
499
+ // we don't allow incomplete structs or unions as subtype
500
+ if (follow (type.subtype ()).id ()==ID_incomplete_struct ||
501
+ follow (type.subtype ()).id ()==ID_incomplete_union)
502
+ {
503
+ // ISO/IEC 9899 6.7.5.2
504
+ error ().source_location =type.source_location ();
505
+ error () << " array has incomplete element type" << eom;
506
+ throw 0 ;
507
+ }
508
+
509
+ // we don't allow functions as subtype
510
+ if (type.subtype ().id ()==ID_code)
511
+ {
512
+ // ISO/IEC 9899 6.7.5.2
513
+ error ().source_location =type.source_location ();
514
+ error () << " array of function element type" << eom;
515
+ throw 0 ;
516
+ }
517
+
499
518
// check size, if any
500
519
501
520
if (size.is_not_nil ())
You can’t perform that action at this time.
0 commit comments