Bug 6851 – [CTFE] Cannot deref pointer passed by argument

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-10-25T05:09:00Z
Last change time
2011-11-03T16:00:50Z
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2011-10-25T05:09:15Z
void setn(int* pn) { *pn = 20; } void test() { int n = 0; auto pn = &n; *pn = 10; assert(n == 10); setn(&n); } static assert({ test(); return true; }()); ---- Output: test.d(3): Error: cannot dereference invalid pointer *pn test.d(11): called from here: setn(& n) test.d(13): called from here: test() test.d(13): called from here: delegate @system bool() { test(); return true; } () test.d(13): Error: static assert (delegate @system bool() { test(); return true; } ()) is not evaluatable at compile time
Comment #1 by bugzilla — 2011-11-03T16:00:50Z