Mercurial > projects > ldc
changeset 772:cd7da2ba14d1
Fix bug reported by downs. Related to delegate types within tuple template parameters.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Tue, 18 Nov 2008 17:14:57 +0100 |
parents | bfabbac8e705 |
children | 5696a7167b21 |
files | dmd/mtype.c tests/mini/compile_delegatetuple.d |
diffstat | 2 files changed, 20 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/dmd/mtype.c Sun Nov 16 20:42:45 2008 +0100 +++ b/dmd/mtype.c Tue Nov 18 17:14:57 2008 +0100 @@ -2951,6 +2951,11 @@ { Argument *arg = Argument::getNth(tf->parameters, i); Type *t; + // each function needs its own copy of a tuple arg, since + // they mustn't share arg flags like inreg, ... + if (arg->type->ty == Ttuple) + arg->type = arg->type->syntaxCopy(); + tf->inuse++; arg->type = arg->type->semantic(loc,sc); if (tf->inuse == 1) tf->inuse--; @@ -3466,7 +3471,7 @@ } } if (t->ty == Ttuple) - *pt = t->syntaxCopy(); + *pt = t; else *pt = t->merge(); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/mini/compile_delegatetuple.d Tue Nov 18 17:14:57 2008 +0100 @@ -0,0 +1,14 @@ +alias char[] string; +template Unstatic(T) { alias T Unstatic; } +template Unstatic(T: T[]) { alias T[] Unstatic; } +template StupleMembers(T...) { + static if (T.length) { + const int id=T[0..$-1].length; + const string str=StupleMembers!(T[0..$-1]).str~"Unstatic!(T["~id.stringof~"]) _"~id.stringof~"; "; + } else const string str=""; +} + +struct Stuple(T...) { + mixin(StupleMembers!(T).str); +} +Stuple!(string, void delegate(float)) foo;