diff --git a/autotest/autotest.bat b/autotest/autotest.bat index e1ae6b2..dee82e5 100644 --- a/autotest/autotest.bat +++ b/autotest/autotest.bat @@ -84,6 +84,12 @@ if %errorlevel% neq 0 goto :error ..\release\oscar64 -i=../include -rt=../include/crt.c -e -n floatstringtest.c if %errorlevel% neq 0 goto :error +..\release\oscar64 -i=../include -rt=../include/crt.c -e qsorttest.c +if %errorlevel% neq 0 goto :error + +..\release\oscar64 -i=../include -rt=../include/crt.c -e -n qsorttest.c +if %errorlevel% neq 0 goto :error + exit /b 0 :error echo Failed with error #%errorlevel%. diff --git a/autotest/qsorttest.c b/autotest/qsorttest.c new file mode 100644 index 0000000..f3ddeeb --- /dev/null +++ b/autotest/qsorttest.c @@ -0,0 +1,83 @@ +#include +#include +#include + +struct Node +{ + int a; + char s[10]; +}; + +void qsort(Node * n, int s) +{ + if (s > 1) + { + Node pn = n[0]; + int pi = 0; + for(int i=1; imLeft->mDecType, vr.mTemp, vr.mReference); } + else if (exp->mLeft->mDecType->mType != DT_TYPE_VOID && vr.mType->mType == DT_TYPE_VOID) + { + mErrors->Error(exp->mLocation, "Cannot cast void object to non void object"); + return ExValue(exp->mLeft->mDecType, vr.mTemp, vr.mReference); + } else { vr = Dereference(proc, block, vr); diff --git a/oscar64/Parser.cpp b/oscar64/Parser.cpp index 5fac08e..c7eff3e 100644 --- a/oscar64/Parser.cpp +++ b/oscar64/Parser.cpp @@ -604,8 +604,8 @@ Expression* Parser::ParseInitExpression(Declaration* dtype) } else { - mErrors->Error(mScanner->mLocation, "Struct/Array constant expression expected"); - dec = new Declaration(mScanner->mLocation, DT_CONST_INTEGER); + exp = ParseRExpression(); + return exp; } exp = new Expression(mScanner->mLocation, EX_CONSTANT);