[Issue 22759] New: ImportC: cannot modify const expression from dereferencing const pointer declared within function.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 10 11:17:38 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22759
Issue ID: 22759
Summary: ImportC: cannot modify const expression from
dereferencing const pointer declared within function.
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: ImportC, rejects-valid
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dave287091 at gmail.com
The following fails to compile:
// test.c
static int *do_something(int * const p){
int * const data = p;
*data = 2; // Error: cannot modify `const` expression `*data`
return 0;
}
This was reduced from code in sqlite.
--
More information about the Digitalmars-d-bugs
mailing list