Showing with 37 additions and 1 deletion.
  1. +14 −1 src/inline.d
  2. +23 −0 test/runnable/inline.d
15 changes: 14 additions & 1 deletion src/inline.d
Original file line number Diff line number Diff line change
Expand Up @@ -2109,7 +2109,20 @@ void expandInline(FuncDeclaration fd, FuncDeclaration parent, Expression eret,
if (vfrom.type.ty == Tdelegate ||
vfrom.type.ty == Tpointer && vfrom.type.nextOf().ty == Tfunction)
{
again = true;
if (arg.op == TOKvar)
{
VarExp ve = cast(VarExp)arg;
if (ve.var.isFuncDeclaration())
again = true;
}
else if (arg.op == TOKsymoff)
{
SymOffExp se = cast(SymOffExp)arg;
if (se.var.isFuncDeclaration())
again = true;
}
else if (arg.op == TOKfunction || arg.op == TOKdelegate)
again = true;
}
}
}
Expand Down
23 changes: 23 additions & 0 deletions test/runnable/inline.d
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,29 @@ void test15207()
auto c = new C15207();
}

/**********************************/
// 15253

struct MessageType15253
{
MessageType15253[] messageTypes;

const void toString1(scope void delegate(const(char)[]) sink)
{
messageTypes[0].toString1(sink);
}
}

struct ProtoPackage15253
{
MessageType15253[] messageTypes;

const void toString1(scope void delegate(const(char)[]) sink)
{
messageTypes[0].toString1(sink);
}
}

/**********************************/

int main()
Expand Down