Issue 18119 - Allow code that may allocated inside __ctfe condition branches in @nogc functions
Summary: Allow code that may allocated inside __ctfe condition branches in @nogc funct...
Status: ASSIGNED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2017-12-24 16:46 UTC by Iain Buclaw
Modified: 2022-12-17 10:32 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Iain Buclaw 2017-12-24 16:46:13 UTC
Original suggestion from here: https://github.com/dlang/dmd/pull/3572
Comment 1 Iain Buclaw 2017-12-24 16:49:25 UTC
The suggestion was to make the following condition statements as specializations.

if (__ctfe) { }
if (!__ctfe) { }

Then, anything in the __ctfe branch that can be evaluated at compile time but would otherwise cause a GC allocation at runtime would be permissible in @nogc functions.
Comment 2 Dlang Bot 2022-03-25 16:47:58 UTC
@ibuclaw updated dlang/dmd pull request #7509 "Fix Issue 18119 - Mark if(__ctfe) blocks as SCOPEctfe" fixing this issue:

- Fix Issue 18119 - Mark if(__ctfe) blocks as SCOPEctfe

https://github.com/dlang/dmd/pull/7509