Skip to content

Primitive binops are translated wrong when the LHS is mutated #27054

Closed

Description

STR

fn main() {
    let x = Box::new(0);
    println!("{}", *x + { drop(x); let _ = Box::new(main); 0 });
}

Expected Results

If this code compiles, it should print 0.

Actual Results

Garbage is printed (the address of main, in fact).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions