File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
c/common/src/codingstandards/c Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -169,10 +169,16 @@ class CEmptyStructExtension extends CCompilerExtension, Struct {
169
169
}
170
170
171
171
// Reference: https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html#Variable-Length
172
- class CVariableLengthArraysExtension extends CCompilerExtension , DeclarationEntry {
172
+ class CVariableLengthArraysExtension extends CCompilerExtension , Field {
173
173
CVariableLengthArraysExtension ( ) {
174
174
getType ( ) instanceof ArrayType and
175
- not getType ( ) .( ArrayType ) .hasArraySize ( )
175
+ not getType ( ) .( ArrayType ) .hasArraySize ( ) and
176
+ // Not the final member of the struct, which is allowed to be variably sized
177
+ not exists ( int lastIndex , Class declaringStruct |
178
+ declaringStruct = getDeclaringType ( ) and
179
+ lastIndex = count ( declaringStruct .getACanonicalMember ( ) ) - 1 and
180
+ this = declaringStruct .getCanonicalMember ( lastIndex )
181
+ )
176
182
}
177
183
178
184
override string getMessage ( ) {
You can’t perform that action at this time.
0 commit comments