Fix array in struct const declaration without braces

This commit is contained in:
drmortalwombat 2024-10-26 18:35:29 +02:00
parent 5b81379dac
commit 887a51b176
2 changed files with 3 additions and 1 deletions

View File

@ -2205,6 +2205,7 @@ Declaration* Declaration::ToConstType(void)
Declaration* ndec = new Declaration(mLocation, mType); Declaration* ndec = new Declaration(mLocation, mType);
ndec->mSize = mSize; ndec->mSize = mSize;
ndec->mStride = mStride; ndec->mStride = mStride;
ndec->mStripe = mStripe;
ndec->mBase = mBase; ndec->mBase = mBase;
ndec->mFlags = mFlags | DTF_CONST; ndec->mFlags = mFlags | DTF_CONST;
ndec->mScope = mScope; ndec->mScope = mScope;
@ -2239,6 +2240,7 @@ Declaration* Declaration::ToMutableType(void)
Declaration* ndec = new Declaration(mLocation, mType); Declaration* ndec = new Declaration(mLocation, mType);
ndec->mSize = mSize; ndec->mSize = mSize;
ndec->mStride = mStride; ndec->mStride = mStride;
ndec->mStripe = mStripe;
ndec->mBase = mBase; ndec->mBase = mBase;
ndec->mFlags = mFlags | DTF_CONST; ndec->mFlags = mFlags | DTF_CONST;
ndec->mScope = mScope; ndec->mScope = mScope;

View File

@ -2332,7 +2332,7 @@ Expression* Parser::ParseConstInitExpression(Declaration* dtype, bool inner)
if (mdec) if (mdec)
{ {
Expression* texp = ParseConstInitExpression(mdec->mBase); Expression* texp = ParseConstInitExpression(mdec->mBase, true);
Declaration* cdec = CopyConstantInitializer(mdec->mOffset, mdec->mBase, texp); Declaration* cdec = CopyConstantInitializer(mdec->mOffset, mdec->mBase, texp);
if (cdec) if (cdec)