diff --git a/oscar64/Constexpr.cpp b/oscar64/Constexpr.cpp index f6da20b..d2d4020 100644 --- a/oscar64/Constexpr.cpp +++ b/oscar64/Constexpr.cpp @@ -651,6 +651,7 @@ Expression* ConstexprInterpreter::EvalConstructor(Expression* exp) { mProcType = exp->mLeft->mDecType; + Expression* pex = exp->mRight; Declaration* cdec = exp->mLeft->mDecType->mParams; int pos = 0; @@ -659,6 +660,28 @@ Expression* ConstexprInterpreter::EvalConstructor(Expression* exp) mParams[pos].PutPtr(Value(&mResult)); pos = 2; + if (pex->mType == EX_LIST) + pex = pex->mRight; + else + pex = nullptr; + cdec = cdec->mNext; + + while (pex && pex->mType == EX_LIST) + { + if (!AddParam(pos, pex->mLeft, cdec)) + return exp; + + pex = pex->mRight; + if (cdec) + cdec = cdec->mNext; + } + + if (pex) + { + if (!AddParam(pos, pex, cdec)) + return exp; + } + mHeap = new ExpandingArray(); Execute(exp->mLeft->mDecValue->mValue); diff --git a/oscar64/Errors.h b/oscar64/Errors.h index 88a3e15..18c7e1c 100644 --- a/oscar64/Errors.h +++ b/oscar64/Errors.h @@ -2,6 +2,7 @@ #include "NumberSet.h" + class Location { public: @@ -12,7 +13,11 @@ public: Location() : mFileName(nullptr), mLine(0), mColumn(0), mFrom(nullptr) {} Location(const Location& loc, const Location* from) : mFileName(loc.mFileName), mLine(loc.mLine), mColumn(loc.mColumn), mFrom(from) - {} + { + static volatile int k; + if (from) + k = from->mLine; + } }; class Ident; diff --git a/oscar64/InterCodeGenerator.cpp b/oscar64/InterCodeGenerator.cpp index efe0200..7b16b6f 100644 --- a/oscar64/InterCodeGenerator.cpp +++ b/oscar64/InterCodeGenerator.cpp @@ -1912,6 +1912,7 @@ void InterCodeGenerator::CopyStruct(InterCodeProcedure* proc, Expression* exp, I nmapper.mReturn = new InterCodeBasicBlock(proc); nmapper.mVarIndex = proc->mNumLocals; nmapper.mConstExpr = false; + nmapper.mLocation = new Location(MapLocation(exp, inlineMapper)); proc->mNumLocals += ccdec->mNumVars; if (inlineMapper) nmapper.mDepth = inlineMapper->mDepth + 1; diff --git a/oscar64/Parser.cpp b/oscar64/Parser.cpp index a2149de..c71b015 100644 --- a/oscar64/Parser.cpp +++ b/oscar64/Parser.cpp @@ -4644,6 +4644,9 @@ void Parser::ParseVariableInit(Declaration* ndec, Expression* pexp) fexp = ResolveOverloadCall(fexp); + if ((fexp->mLeft->mDecValue->mFlags & DTF_CONSTEXPR) && ndec->mSection == mBSSection) + ndec->mSection = mDataSection; + Expression* dexp = nullptr; if (ndec->mBase->mDestructor) {