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

Deprecate no-op assignments #20674

Closed
Herringway opened this issue Jan 9, 2025 · 2 comments · Fixed by #20696
Closed

Deprecate no-op assignments #20674

Herringway opened this issue Jan 9, 2025 · 2 comments · Fixed by #20696

Comments

@Herringway
Copy link
Contributor

Who hasn't been bitten by this bug?

struct Foo {
  int bar;
  this(int bar) {
    bar = bar;
  }
}

Instead of assigning the constructor parameter to the struct member as intended, this does nothing. Oops.

As long as there's no opAssign overload involved, these mistakes are guaranteed to be no-ops. Let's make them errors instead.

@thewilsonator
Copy link
Contributor

This is a duplicate of a bug I have reported in the past. Can't remember what number it is though.

@ntrel
Copy link
Contributor

ntrel commented Jan 10, 2025

@thewilsonator #17874

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants