Skip to content

cmd/compile: function compiles OK with no return statement #49003

@rogpeppe

Description

@rogpeppe

commit 1cbec68

The following program compiles and runs, but it should complain that there's no return statement in f:

package main

func main() {
	_ = f("")
}

func f(s string) string {
	for range s {
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.release-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions