Mercurial > projects > ldc
view tests/mini/aa7.d @ 486:a34078905d01
Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in.
Reimplemented support for nested functions/class using a new approach.
Added error on taking address of intrinsic.
Fixed problems with the ->syntaxCopy of TypeFunction delegate exp.
Removed DtoDType and replaced all uses with ->toBasetype() instead.
Removed unused inplace stuff.
Fixed a bunch of issues in the runtime unittests, not complete yet.
Added mini tests.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Sun, 10 Aug 2008 08:37:38 +0200 |
parents | |
children | f8c979770af3 |
line wrap: on
line source
// adapted from dstress.run.a.associative_array_19_A to catch regressions early module mini.aa7; extern (C) int printf(char*, ...); extern (C) void gc_collect(); union Key{ char x; } class Payload { this(Key value) { value.x += 1; _value = value; } Key value() { return _value; } Key _value; } int main(){ Payload[Key] aa; Key[] allKeys; static Key a = { 'a' }; static Key b = { 'b' }; static Key c = { 'c' }; allKeys ~= a; allKeys ~= b; allKeys ~= c; foreach(Key key; allKeys) { aa[key] = new Payload(key); } int i = 0; foreach(Key key; allKeys) { printf("1st #%d\n", i++); assert(key in aa); } gc_collect(); i = 0; foreach(Key key; allKeys) { printf("2nd #%d\n", i++); assert(key in aa); } return 0; }