mirror of
https://github.com/golang/go.git
synced 2026-04-04 02:10:08 +09:00
Fixes #77868 Change-Id: I3348825e24a71595c514113497db365a6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/749881 Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: David Chase <drchase@google.com>
21 lines
416 B
Go
21 lines
416 B
Go
// compile
|
|
|
|
// Copyright 2026 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package p
|
|
|
|
type S struct {
|
|
n int
|
|
a [2]int
|
|
}
|
|
|
|
func f(i int) int {
|
|
var arr [0]S
|
|
|
|
// Accessing a zero-length array must not trigger an internal compiler error.
|
|
// This code is invalid, but make sure that we can compile it.
|
|
return arr[i].n
|
|
}
|