Skip to content

Deprecate no-op assignments #20674

@Herringway

Description

@Herringway

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions