Skip to content

Commit

Permalink
Fix Issue 20656 - cannot compile live function without -preview=dip1021
Browse files Browse the repository at this point in the history
  • Loading branch information
kubo39 committed Mar 9, 2020
1 parent d7b0cc5 commit bc770aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/dmd/semantic3.d
Expand Up @@ -1336,7 +1336,8 @@ private extern(C++) final class Semantic3Visitor : Visitor
}

// Do live analysis
if (funcdecl.fbody && funcdecl.type.ty != Terror && funcdecl.type.isTypeFunction().islive)
if (global.params.useDIP1021 && funcdecl.fbody && funcdecl.type.ty != Terror &&
funcdecl.type.isTypeFunction().islive)
{
oblive(funcdecl);
}
Expand Down
11 changes: 11 additions & 0 deletions test/compilable/test20656.d
@@ -0,0 +1,11 @@
// https://issues.dlang.org/show_bug.cgi?id=20656

import core.stdc.stdlib : free, malloc;

@live
void main()
{
auto p = malloc(1);
free(p);
free(p);
}

0 comments on commit bc770aa

Please sign in to comment.