You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// You can edit this code!// Click here and start typing.package main
import"fmt"funcmain() {
consta=len([1]int{
func() int { println("hey!!"); return1 }(),
})
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.
this code fails in the go playground, because
a
is not a constant expression:however, it is correctly parsed and succeeds in gno.
related #3600
The text was updated successfully, but these errors were encountered: