Closed
Description
Proposal Details
The code
func _[A C](a A) {
const _ = len(a) // or cap(a)
}
should be valid if the constraint C
describes a type set containing only (pointer to) arrays and all arrays have the same length. Currently, the length and capacity of a type parameter value are always non-constant. Either way, the type is defined to be int
per the spec. An int
constant value can be used wherever an int
non-constant value is permitted. Thus, this change is strictly backward-compatible; it simply increases the set of valid programs.
See also #50226.