Got compiler crash in Mangler::mangleFuncType

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Sat Mar 25 07:07:59 PDT 2017


On 2017-03-25 09:13, Uranuz wrote:

> I just put debug messages on every `assert` and figured out it fails on
> lines:
>                     bool implicit0 = (f.next.ty == Tvoid && isMain());
>                     Type tret = implicit0 ? Type.tint32 : f.next;
>                     assert(tret.ty != Tvoid);
>                     if (vresult || returnLabel)
>                         buildResultVar(scout ? scout : sc2, tret);
> I really don't understand what it is... Now I cannot share codebase
> easily. Seems that it fails on my programme `main` function or near
> that, because compiler stack not so deep. There is some check for isMain
> AFAIK... What is this about?

To me it looks like there's some mismatch of the declared return type of 
"main" and what is actually returned. In D it's possible to declare 
"main" to return "void" and the compiler/runtime will automatically 
handle and infer the exit code of the program. Can you show just the 
"main" function?

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list