Repository navigation
Conversation
|
Thanks for your pull request and interest in making D better, @dkorpel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.
|
| .deprecation(loc, "`pure` %s `%s` accessing mutable static data `%s` in default argument", | ||
| sc.func.kind(), sc.func.toPrettyChars(), v.toErrMsg()); | ||
| else | ||
| { | ||
| error(loc, "`pure` %s `%s` cannot access mutable static data `%s`", | ||
| sc.func.kind(), sc.func.toPrettyChars(), v.toErrMsg()); |
There was a problem hiding this comment.
any reason not to use previewErrorFunc here?
There was a problem hiding this comment.
I'm trying to get something basic working here before making it nice and tidy. The more pressing issue currently is that void defaultUnsafe2(int x = globalPtr[1]) @safe still gives an Error instead of a Deprecation. I'll mark it as ready for review and ping once it's in a good state.
There was a problem hiding this comment.
I tried it, it gets a bit messy with the message being different in the two branches. I think 2 statements is clearer.
| { | ||
| if (useDeprecation) | ||
| { | ||
| .deprecation(loc, "`pure` %s `%s` calling impure %s `%s` in default argument", |
| if (useDeprecation) | ||
| { | ||
| // Introduced in 2.113 | ||
| .deprecation(loc, "`@safe` %s `%s` calling `@system` %s `%s` in default argument", |
0e72b39 to
43cdeb5
Compare
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Direct memory-safety violations (e.g. indexing a pointer) go through sc.setUnsafe rather than the function-call checkSafety path, so they still emitted a hard error in default arguments. Emit a deprecation there too, consistent with the other default-argument attribute checks. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…cation case Co-Authored-By: Claude Opus 4.8 <[email protected]>
43cdeb5 to
5ea0b21
Compare
Closes #18670