[Issue 14807] New: unnecessary closure allocation for function literal in compile time test
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jul 17 13:34:17 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14807
Issue ID: 14807
Summary: unnecessary closure allocation for function literal in
compile time test
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: code at dawg.eu
cat > bug.d << CODE
void foo(int a) @nogc
{
static if (__traits(compiles, { a = 2; }))
{}
}
CODE
bug.d(1): Error: function bug.foo @nogc function allocates a closure with the
GC
----
Not sure if it's easy to detect the context of a function literal and see that
it can never be called.
--
More information about the Digitalmars-d-bugs
mailing list