[Issue 6517] New: [CTFE] ptr++ doesn't work but ++ptr does
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Aug 17 04:45:27 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6517
Summary: [CTFE] ptr++ doesn't work but ++ptr does
Product: D
Version: unspecified
Platform: Other
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: dsimcha at yahoo.com
--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2011-08-17 04:45:24 PDT ---
int ctfeFun(const int[] arr) {
auto startp = arr.ptr;
auto endp = arr.ptr + arr.length;
for(; startp < endp; startp++) {}
return 0;
}
const arr = [1, 2, 3];
enum ans = ctfeFun(arr);
test9.d(5): Error: pointer expression startp++ cannot be interpreted at compile
time
test9.d(11): Error: cannot evaluate ctfeFun(arr) at compile time
Changing startp++ to ++startp fixes the problem.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list