Consider:
---
pragma(printf) extern (C) int printf(const(char)* fmt, ...);
void test(int* p, const int* pc)
{
printf("%n\n", p); // compiles correctly without error
printf("%n\n", pc); // should not compile as p points to const
}
---
Comment #1 by dlang-bot — 2023-09-03T10:06:23Z
@WalterBright created dlang/dmd pull request #15569 "fix Issue 24133 - printf format checking of %n allows writing to cons…" fixing this issue:
- fix Issue 24133 - printf format checking of %n allows writing to const pointers
https://github.com/dlang/dmd/pull/15569
Comment #2 by dlang-bot — 2023-09-03T12:10:32Z
dlang/dmd pull request #15569 "fix Issue 24133 - printf format checking of %n allows writing to cons…" was merged into master:
- 9e47262906cb713b1d754a4daeb098594c7eff82 by Walter Bright:
fix Issue 24133 - printf format checking of %n allows writing to const pointers
https://github.com/dlang/dmd/pull/15569