Skip to content
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

with breaks @safe #20824

Open
Bolpat opened this issue Feb 5, 2025 · 0 comments
Open

with breaks @safe #20824

Bolpat opened this issue Feb 5, 2025 · 0 comments
Labels
dip1000 memory safety with scope, ref, return Severity:accepts-invalid

Comments

@Bolpat
Copy link
Contributor

Bolpat commented Feb 5, 2025

Offending code:

struct S { int x; }

void main() @safe
{
    int* p;
    with (S()) p = &x;
}

Without DIP1000, it takes the address of a local. With DIP1000, it assigns p to a value with shorter lifetime.

In both cases, no compile-error.

Tags: DIP1000 (maybe), accepts invalid

@schveiguy schveiguy added dip1000 memory safety with scope, ref, return Severity:accepts-invalid labels Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dip1000 memory safety with scope, ref, return Severity:accepts-invalid
Projects
None yet
Development

No branches or pull requests

2 participants