Test cases

- Added `simple_pointer_cast.t` to test casting (currently broken parsing-wise)

DGen

- Added a todo for semantic tests for the `simple_pointer_cast.t` test case
This commit is contained in:
Tristan B. Velloza Kildaire 2023-04-14 12:52:59 +02:00
parent d58e5aad4d
commit 6611cb4593
2 changed files with 24 additions and 0 deletions

View File

@ -818,6 +818,7 @@ int main()
return 0;
}`);
}
// TODO: Add semantic test for simple_pointer_cast.t
else if(cmp(typeChecker.getModule().getName(), "simple_extern") == 0)
{
file.writeln(`

View File

@ -0,0 +1,23 @@
module simple_pointer_cast;
int j;
int ret()
{
return 0;
}
int function(int* ptr)
{
*(cast(int*)ret())=2;
*(ptr+ret()) = 2+2;
return (*ptr)+1*2;
}
int thing()
{
int discardExpr = function(&j);
int** l;
return discardExpr;
}