Bug 17884 – fwd reference leads to dmd assert failure
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-10-08T04:44:18Z
Last change time
2020-03-21T03:56:40Z
Keywords
ice
Assigned to
No Owner
Creator
Walter Bright
Comments
Comment #0 by bugzilla — 2017-10-08T04:44:18Z
struct S()
{
void delegate() d;
}
S!() f_Ds(U)()
{
pragma(msg,U);
static if (is(U == struct))
return S!()
(
{
foreach (i, field; U.init.tupleof)
f_Ds!(typeof(field))();
}
);
else
return f_Ds!(D)();
}
void f_E()
{
auto f = S!()
(
{
enum x = is(typeof(f_Ds!(D*)()));
f_Ds!(D*)();
}
);
}
struct A
{
D d;
}
struct D
{
A a;
int b;
}
void main()
{
f_E();
f_Ds!(D*)();
}
-----------------------
dmd bug
bug.d(40): Error: struct bug.A no size because of forward reference
[email protected](380): Assertion failure
----------------
0x005FD23F in _d_assertp
0x0040477A in AggregateDeclaration at C:\cbx\mars\aggregate.d(339)
0x00404890 in AggregateDeclaration at C:\cbx\mars\aggregate.d(377)
0x004EE4E0 in TypeStruct at C:\cbx\mars\mtype.d(8662)
0x00434C64 in VarDeclaration at C:\cbx\mars\declaration.d(1199)
0x0045F5D7 in StructDeclaration at C:\cbx\mars\dstruct.d(373)
0x00454D54 in Module at C:\cbx\mars\dmodule.d(1065)
0x004D9F9F in int ddmd.mars.tryMain(uint, const(char)**) at C:\cbx\mars\mars.d(847)
0x004DAB43 in _Dmain at C:\cbx\mars\mars.d(1086)
0x005FF73B in D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFNlZv
0x005FF6FF in scope void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()
0x005FF600 in _d_run_main
0x004DCDD8 in main at C:\cbx\mars\root\stringtable.d(7)
0x0061B245 in mainCRTStartup
0x74F3336A in BaseThreadInitThunk
0x77359902 in RtlInitializeExceptionChain
0x773598D5 in RtlInitializeExceptionChain