1// errorcheck
2
3// Copyright 2023 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7package p
8
9import "unsafe"
10
11type E [1 << 30]complex128
12
13var a [1 << 30]E
14var _ = unsafe.Sizeof(a) // ERROR "too large"
15
16var s struct {
17	_ [1 << 30]E
18	x int
19}
20var _ = unsafe.Offsetof(s.x) // ERROR "too large"
21
22// Test case from issue (modified so it also triggers on 32-bit platforms).
23
24type A [1]int
25type S struct {
26	x A
27	y [1 << 30]A
28	z [1 << 30]struct{}
29}
30type T [1 << 30][1 << 30]S
31
32func _() {
33	var a A
34	var s S
35	var t T
36	_ = unsafe.Sizeof(a)
37	_ = unsafe.Sizeof(s)
38	_ = unsafe.Sizeof(t) // ERROR "too large"
39}
40