Mercurial > projects > dang
annotate tests/code/sarray_3.d @ 161:0e10479623f6
Changed the tests for static arrays a little
The following code IS legal:
int[10] a;
int[10] b = a;
It's only assignment outside of init thats illegal
Also a test for a[] = b, which should compile to a memcpy
author | Anders Halager <halager@gmail.com> |
---|---|
date | Tue, 22 Jul 2008 13:39:15 +0200 |
parents | |
children |
rev | line source |
---|---|
161
0e10479623f6
Changed the tests for static arrays a little
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
1 //fail |
0e10479623f6
Changed the tests for static arrays a little
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
2 int main() |
0e10479623f6
Changed the tests for static arrays a little
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
3 { |
0e10479623f6
Changed the tests for static arrays a little
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
4 int[10] a; |
0e10479623f6
Changed the tests for static arrays a little
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
5 // static array initialization is legal |
0e10479623f6
Changed the tests for static arrays a little
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
6 int[10] b = a; |
0e10479623f6
Changed the tests for static arrays a little
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
7 // static array assignment is illegal |
0e10479623f6
Changed the tests for static arrays a little
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
8 b = a; |
0e10479623f6
Changed the tests for static arrays a little
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
9 } |
0e10479623f6
Changed the tests for static arrays a little
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
10 |