mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-22 06:33:14 +01:00
Fix bug reported by downs. Related to delegate types within tuple template parameters.
This commit is contained in:
@@ -2951,6 +2951,11 @@ Type *TypeFunction::semantic(Loc loc, Scope *sc)
|
||||
{ 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 @@ L1:
|
||||
}
|
||||
}
|
||||
if (t->ty == Ttuple)
|
||||
*pt = t->syntaxCopy();
|
||||
*pt = t;
|
||||
else
|
||||
*pt = t->merge();
|
||||
}
|
||||
|
||||
14
tests/mini/compile_delegatetuple.d
Normal file
14
tests/mini/compile_delegatetuple.d
Normal file
@@ -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;
|
||||
Reference in New Issue
Block a user