annotate run/opCatAssign_08.d @ 356:a1f59b48d72c

mixin opCatAssign Regan Heath <regan@netwin.co.nz> 2005-03-17 news:opsnrsp6fs23k2f5@nrage.netwin.co.nz
author thomask
date Tue, 22 Mar 2005 19:50:01 +0000
parents
children b8c0195059d9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
356
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
1 // $HeadURL$
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
2 // $Date$
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
3 // $Author$
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
4
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
5 // @author@ Regan Heath <regan@netwin.co.nz>
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
6 // @date@ 2005-03-17
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
7 // @uri@ news:opsnrsp6fs23k2f5@nrage.netwin.co.nz
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
8
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
9 module dstress.run.opCatAssign_08;
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
10
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
11 int status;
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
12
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
13 class MyClass{
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
14 template opCatAssign(Type){
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
15 MyClass opCatAssign(Type arr){
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
16 status+=3;
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
17 return this;
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
18 }
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
19 }
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
20 mixin opCatAssign!(int[]);
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
21 }
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
22
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
23 int main(){
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
24 static int[] arr = [0,1,2];
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
25 MyClass a = new MyClass();
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
26
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
27 assert(status==0);
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
28 a ~= arr;
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
29 assert(status==3);
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
30 return 0;
a1f59b48d72c mixin opCatAssign
thomask
parents:
diff changeset
31 }