r4757@macbookpro: aamine | 2009-05-07 12:12:35 +0900

test address-of more.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4190 1b9489fe-b721-0410-924e-b54b9192deb8
This commit is contained in:
Minero Aoki 2009-05-08 10:41:01 +00:00
parent e06185e56d
commit c3868b417f
2 changed files with 36 additions and 0 deletions

35
test/addressof.cb Normal file
View File

@ -0,0 +1,35 @@
import stdio;
import string;
struct s {
char[8] str;
};
int
main(int argc, char** argv)
{
struct s s;
struct s * sp;
char *str;
str = s.str;
strcpy(str, "OK");
printf("%s", str);
str = &s.str;
strcpy(str, "OK");
printf(";%s", str);
sp = &s;
str = sp->str;
strcpy(str, "OK");
printf(";%s", str);
sp = &s;
str = &sp->str;
strcpy(str, "OK");
printf(";%s", str);
puts("");
return 0;
}

View File

@ -206,6 +206,7 @@ test_22_pointer() {
assert_out "777" ./pointer4
assert_out "1;2;3;4;5;6;77;78" ./ptrmemb
assert_out "7" ./ptrmemb2
assert_out "OK;OK;OK;OK" ./addressof
assert_compile_error deref-semcheck1.cb
assert_compile_error deref-semcheck2.cb
assert_compile_error deref-semcheck3.cb