diff --git a/ChangeLog b/ChangeLog index c3a000b..2719548 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Jan 3 20:31:54 2008 Minero Aoki + + * test/ptrtostruct.cb: test (*ptr).memb access. + Thu Jan 3 20:26:01 2008 Minero Aoki * net/loveruby/cflat/compiler/TypeChecker.java: <<, >> does not diff --git a/test/Makefile b/test/Makefile index 4028154..188be9f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -17,6 +17,7 @@ CBPROGS = zero one hello hello2 hello3 hello4 integer string \ charops shortops intops longops \ ucharops ushortops uintops ulongops \ block cast defvar mbc assoc \ + ptrtostruct \ ANT = jant diff --git a/test/ptrtostruct.cb b/test/ptrtostruct.cb new file mode 100644 index 0000000..96ef1f4 --- /dev/null +++ b/test/ptrtostruct.cb @@ -0,0 +1,14 @@ +import stdio; + +struct s { int x; }; + +int +main(int argc, char **argv) +{ + struct s s; + struct s* ptr = &s; + + (*ptr).x = 1; + printf("%d\n", (*ptr).x); + return 0; +} diff --git a/test/test.sh b/test/test.sh index 43be552..efaf712 100755 --- a/test/test.sh +++ b/test/test.sh @@ -139,6 +139,7 @@ assert_out "1;2;1;1;3;4;5;6;OK" ./usertype assert_out "5;5" ./pointer assert_out "1;2" ./ptrmemb +assert_out "1" ./ptrtostruct assert_error $CBC deref-semcheck1.cb assert_error $CBC deref-semcheck2.cb assert_error $CBC deref-semcheck3.cb