Bug 18494 – nogc ignores invariant

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-02-22T13:35:16Z
Last change time
2024-12-13T18:57:15Z
Assigned to
No Owner
Creator
FeepingCreature
See also
https://issues.dlang.org/show_bug.cgi?id=4995
Moved to GitHub: dmd#19394 →

Comments

Comment #0 by default_357-line — 2018-02-22T13:35:16Z
Comment #1 by default_357-line — 2018-02-22T13:36:55Z
Reproduce: class Class { invariant { new Object; } void foo() @nogc { } } void test() @nogc { (new Class).foo; } void main() { test(); } Expected: error about gc allocation in @nogc violation Outcome: runs silently Further wrinkle: void foo() @nogc in { new Object; } body { } ^ this one errors! Either the second function should work (preferred) or the first one should also error.
Comment #2 by robert.schadek — 2024-12-13T18:57:15Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19394 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB