annotate test/bug6.d @ 32:a86fe7496b58 trunk

[svn r36] * Fixed a bug where passing a regular argument to a ref argument did not allocate storage
author lindquist
date Thu, 04 Oct 2007 18:24:05 +0200
parents
children
rev   line source
lindquist@32 1 module bug6;
lindquist@32 2 class wrong { }
lindquist@32 3 void bark(ref wrong s) { s = new wrong; }
lindquist@32 4 void foo(wrong tree) {
lindquist@32 5 auto old = tree;
lindquist@32 6 bark(tree);
lindquist@32 7 assert(old !is tree);
lindquist@32 8 }
lindquist@32 9 void main()
lindquist@32 10 {
lindquist@32 11 auto w = new wrong;
lindquist@32 12 auto old = w;
lindquist@32 13 foo(w);
lindquist@32 14 assert(w is old);
lindquist@32 15 }