New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix Issue 22541 - DIP1000: Resolve ambiguity of ref-return-scope para… #13677
Conversation
Thanks for your pull request, @WalterBright! Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#13677" |
Should this target stable? |
I'd rather not. It could be a disruptive change. |
int i; | ||
int* ptr; | ||
|
||
int* wannabeReturnRef() scope return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be marked @safe
@dkorpel @WalterBright Should this have a changelog |
It already has a changelog: https://dlang.org/changelog/2.099.0.html#22541 This patch makes the compiler accept the function definition, but on a function call it still thinks it's struct S
{
int i;
int* ptr;
int* wannabeReturnRef() scope return @safe
{
return &i;
}
}
int* wannabeReturnRefFree(scope return ref S s) @safe
{
return &s.i; // should be accepted
}
int* gPtr;
void main() @safe
{
S s;
gPtr = s.wannabeReturnRef(); // should be rejected
gPtr = s.wannabeReturnRefFree(); // should be rejected
} |
@dkorpel I think that changelog is very poor. |
It is, should we remove it until it's actually implemented correctly, or expand it but also add a footnote that the implementation isn't ready? |
…meters
Actually, fixes https://issues.dlang.org/show_bug.cgi?id=22541#c7