[Issue 21614] compiled imports: core.exception.AssertError at src/dmd/semantic3.d(812): Assertion failure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 6 18:38:24 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21614

--- Comment #5 from Iain Buclaw <ibuclaw at gdcproject.org> ---
(In reply to Iain Buclaw from comment #4)
> (In reply to Iain Buclaw from comment #2)
> > In the unreduced test, a function that is marked `inferRetType` has a return
> > statement, but the return type is inferred as `void` (possibly because
> > semantic never finished for it).  Hence the assert is triggered.
> This assumption was wrong.  What really happens is that there's a
> constructor marked as `inferRetType`.  It's body is empty so it is inferred
> `void`.  Then an automatic `return this` statement is appended to the body
> (because it isCtorDeclaration), and an assert is triggered because the
> return type is `void`.
And to add insult to injury, because of a self-reference (the import statement
that leads back to current module), during the semantic1 pass of `struct
Tuple`, the semantic1 pass of the constructor is skipped, jumping straight to
`semantic2`.

--


More information about the Digitalmars-d-bugs mailing list