Bug 24614 – Can’t throw in -betterC mode with -preview=dip1008 (@nogc Exceptions)

Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-06-17T11:26:59Z
Last change time
2024-06-17T11:31:46Z
Assigned to
No Owner
Creator
Bolpat

Comments

Comment #0 by qs.il.paperinik — 2024-06-17T11:26:59Z
Maybe this is invalid, but the Description section of DIP 1008 ("Exceptions and @nogc") gives the impression that this should be possible. Quote from DIP 1008: > The issue is [exceptions being GC allocated] […] prevents building D programs that do not link in the GC runtime. The prime example for D programs without GC runtime are `-betterC` programs. That `-betterC` mode does not allow for Exceptions may be due to reasons other than being unable to GC-allocate them, but maybe not, and therefore this bug report.
Comment #1 by alphaglosined — 2024-06-17T11:31:46Z
D classes depend upon druntime. Runtime exceptions ala ``Throwable`` hierarchy depend upon druntime. As of right now this is expected and correct behavior for runtime exceptions to not work in -betterC. There is a high desire to see some variant of value based sumtype returns in the language hooked into ``throw`` and ``catch`` that do not depend upon druntime, however that is not currently in the DIP queue due to a dependency upon sumtypes.