Description
// You can edit this code!
// Click here and start typing.
package main
import "fmt"
func main() {
const a = len([1]int{
func() int { println("hey!!"); return 1 }(),
})
fmt.Println("Hello", a)
}
this code fails in the go playground, because a
is not a constant expression:
The expression len(s) is constant if s is a string constant. The expressions len(s) and cap(s) are constants if the type of s is an array or pointer to an array and the expression s does not contain channel receives or (non-constant) function calls; in this case s is not evaluated. Otherwise, invocations of len and cap are not constant and s is evaluated.
however, it is correctly parsed and succeeds in gno.
related #3600
Metadata
Assignees
Type
Projects
Status
Triage