-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cc65#2199 from acqn/FAMFix
[cc65] Forbidden struct itself with flexible array member as struct member or array element
- Loading branch information
Showing
3 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* Bug #2016 - cc65 erroneously allows struct fields that are structs with flexible array members */ | ||
|
||
typedef struct x { | ||
int a; | ||
int b[]; /* Ok: Flexible array member can be last */ | ||
} x; | ||
|
||
struct y { | ||
x x; /* Not ok: Contains flexible array member */ | ||
int a; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* Bug #2017 - cc65 erroneously allows arrays of structs with flexible array members */ | ||
|
||
struct z { | ||
int a; | ||
int c; | ||
int b[]; | ||
}; | ||
|
||
struct z y[3]; /* Should be an error */ |