April 24, 2022 [Issue 23055] New: importC: using compound-literal array as pointer in CTFE gives 'dereference of invalid pointer' | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23055 Issue ID: 23055 Summary: importC: using compound-literal array as pointer in CTFE gives 'dereference of invalid pointer' Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: CTFE, ImportC Severity: minor Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: duser@neet.fi CC: duser@neet.fi int fn() { int *p = (int[1]){0}; *p = 0; return *p; } _Static_assert(fn() == 0, ""); int main() { return fn(); } test.c(4): Error: dereference of invalid pointer `[0]` test.c(7): called from here: `fn()` test.c(7): while evaluating: `static assert(fn() == 0)` it works outside CTFE -- |
Copyright © 1999-2021 by the D Language Foundation