Bug 24327 – LDC --nogc should work for scope class instance

Status
NEW
Severity
minor
Priority
P1
Component
tools
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2024-01-11T07:00:16Z
Last change time
2024-01-11T08:06:29Z
Assigned to
No Owner
Creator
a11e99z

Comments

Comment #0 by black80 — 2024-01-11T07:00:16Z
import core.stdc.stdio; class C { @nogc: public: this() { printf( "C.C\n"); } ~this() { printf( "C.~C\n"); } } void main() @nogc { printf( "=> main\n"); scope(exit) printf( "<= main\n"); scope c = new C(); // LOC 14 } //------------------------- ldc2 file.d - OK ldc2 --nogc file.d: file.d(14): Error: No implicit garbage collector calls allowed with -nogc option enabled: `_d_callfinalizer` shouldn't check/call GC for scope vars
Comment #1 by black80 — 2024-01-11T08:06:29Z
BTW I prefer: auto c = scope C(); cuz new X means heap/GC, scope means scope