Skip to content

multiple-value-return plays badly with access to return variables in defer #846

@rogpeppe

Description

@rogpeppe
the following code causes the compiler to give the
message: "error in shape across RETURN"

package test

func x() (a int, b string) {
    defer func(){
        a++
    }()
    return y()
}

func y() (int, string) {
    return 0, ""
}

8g darwin 386 443fb42ed60e+ tip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions