Commit ea8ef2c
Mandeep Singh Grang
An nt_checked array with an empty initializer list should be an error (#1121)
Consider the following declaration of an nt_checked array:
char p nt_checked[] = {}
According to the Checked C spec section 2.4:
1. nt_checked declares an array whose last element is a null terminator. The size
of the array includes the null terminator element.
2. An nt_checked array with size d converts to an nt_array_ptr with a count of d -
1 elements.
So it should be illegal to declare an nt_checked array with an empty initializer list.
This fixes issue #1120.1 parent c6edde1 commit ea8ef2c
2 files changed
Lines changed: 12 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2260 | 2260 | | |
2261 | 2261 | | |
2262 | 2262 | | |
2263 | | - | |
| 2263 | + | |
2264 | 2264 | | |
2265 | 2265 | | |
2266 | 2266 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13023 | 13023 | | |
13024 | 13024 | | |
13025 | 13025 | | |
13026 | | - | |
13027 | | - | |
13028 | | - | |
13029 | | - | |
| 13026 | + | |
| 13027 | + | |
| 13028 | + | |
| 13029 | + | |
| 13030 | + | |
| 13031 | + | |
| 13032 | + | |
| 13033 | + | |
| 13034 | + | |
| 13035 | + | |
| 13036 | + | |
13030 | 13037 | | |
13031 | 13038 | | |
13032 | 13039 | | |
| |||
0 commit comments