Bug 5874 – alloca should be pure

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-04-23T12:28:00Z
Last change time
2014-03-19T17:40:05Z
Keywords
rejects-valid
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2011-04-23T12:28:36Z
import core.stdc.stdlib; void doAlloca() pure { alloca(8); } void main() { doAlloca(); } Error: pure function 'doAlloca' cannot call impure function 'alloca'
Comment #1 by bearophile_hugs — 2011-04-23T14:13:58Z
I approve of this. In the meantime a workaround is to use a extern in the module (it's not @trusted): extern(C) pure nothrow void* alloca(in size_t size);
Comment #2 by lt.infiltrator — 2014-03-19T17:40:05Z
*** This issue has been marked as a duplicate of issue 4222 ***