this crashes the compiler
---
alias noreturn = typeof(*null);
void main()
{
auto a = noreturn.init;
}
---
DMD dirty 9d718f2f8c7f34d3b616791493d9e71d7527f221
Comment #1 by dlang-bot — 2021-05-27T22:29:48Z
@MoonlightSentinel updated dlang/dmd pull request #12586 "Fix 21951 - Add missing defaultInit literal for `noreturn`" fixing this issue:
- Fix 21951 - Add missing defaultInit literal for `noreturn`
Otherwise further semantic for `noreturn` variables / overload resultion
will segfault.
The default initializer is defined as `assert(false)` for now. This
might need to be revised to satisfy [1] once the backend is adapted to
handle `noreturn` outside of return values (currently either crashes or
hits assertion failures).
[1]:
> Defining a noreturn variable with no initialization expression
> generates an assert(0) only if the variable is accessed, which can be
> useful in generic code where unused noreturn variables may be declared
https://github.com/dlang/dmd/pull/12586
Comment #2 by dlang-bot — 2021-06-15T13:03:29Z
@RazvanN7 updated dlang/dmd pull request #12688 "Fix Issue 22017 - with() on struct method that returns this destroys too early" fixing this issue:
- Fix 21951 - Add missing defaultInit literal for `noreturn`
Otherwise further semantic for `noreturn` variables / overload resultion
will segfault.
The default initializer is defined as `assert(false)` for now. This
might need to be revised to satisfy [1] once the backend is adapted to
handle `noreturn` outside of return values (currently either crashes or
hits assertion failures).
[1]:
> Defining a noreturn variable with no initialization expression
> generates an assert(0) only if the variable is accessed, which can be
> useful in generic code where unused noreturn variables may be declared
https://github.com/dlang/dmd/pull/12688
Comment #3 by moonlightsentinel — 2021-06-21T20:34:35Z
Re-tagged as a backend issue because it now triggers an assertion failure:
dmd: src/dmd/backend/cod4.d:416: Assertion `cast(int)sz > 0' failed.
Comment #4 by dlang-bot — 2021-06-27T09:48:28Z
@Geod24 created dlang/dmd pull request #12765 "Merge stable into master" fixing this issue:
- Fix 21951 - Add missing defaultInit literal for `noreturn`
Otherwise further semantic for `noreturn` variables / overload resultion
will segfault.
The default initializer is defined as `assert(false)` for now. This
might need to be revised to satisfy [1] once the backend is adapted to
handle `noreturn` outside of return values (currently either crashes or
hits assertion failures).
[1]:
> Defining a noreturn variable with no initialization expression
> generates an assert(0) only if the variable is accessed, which can be
> useful in generic code where unused noreturn variables may be declared
https://github.com/dlang/dmd/pull/12765
Comment #5 by dlang-bot — 2021-06-27T11:18:04Z
@MoonlightSentinel created dlang/dmd pull request #12768 "Merge stable into master" fixing this issue:
- Fix 21951 - Add missing defaultInit literal for `noreturn`
Otherwise further semantic for `noreturn` variables / overload resultion
will segfault.
The default initializer is defined as `assert(false)` for now. This
might need to be revised to satisfy [1] once the backend is adapted to
handle `noreturn` outside of return values (currently either crashes or
hits assertion failures).
[1]:
> Defining a noreturn variable with no initialization expression
> generates an assert(0) only if the variable is accessed, which can be
> useful in generic code where unused noreturn variables may be declared
https://github.com/dlang/dmd/pull/12768
Comment #6 by dlang-bot — 2021-06-27T12:25:24Z
dlang/dmd pull request #12768 "Merge stable into master" was merged into master:
- 90bb0328af61ed7c3c4a0fa005578d9903a07991 by MoonlightSentinel:
Fix 21951 - Add missing defaultInit literal for `noreturn`
Otherwise further semantic for `noreturn` variables / overload resultion
will segfault.
The default initializer is defined as `assert(false)` for now. This
might need to be revised to satisfy [1] once the backend is adapted to
handle `noreturn` outside of return values (currently either crashes or
hits assertion failures).
[1]:
> Defining a noreturn variable with no initialization expression
> generates an assert(0) only if the variable is accessed, which can be
> useful in generic code where unused noreturn variables may be declared
https://github.com/dlang/dmd/pull/12768