1
0
mirror of https://github.com/golang/go synced 2024-11-22 20:24:47 -07:00
go/test/fixedbugs/notinheap.go
Cuong Manh Le 72cc7699f8 test: add test cases for local not-in-heap types
Follow up review in CL 597535.

Updates #54846

Change-Id: Idf586552a22bbc6710c0888f046df0a5d1f0ce4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/597537
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-07-24 00:11:49 +00:00

38 lines
972 B
Go

// errorcheck -+
// Copyright 2016 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.
// Test type-checking errors for not-in-heap types.
//go:build cgo
package p
import "runtime/cgo"
type nih struct{ _ cgo.Incomplete }
type embed4 map[nih]int // ERROR "incomplete \(or unallocatable\) map key not allowed"
type embed5 map[int]nih // ERROR "incomplete \(or unallocatable\) map value not allowed"
type emebd6 chan nih // ERROR "chan of incomplete \(or unallocatable\) type not allowed"
type okay1 *nih
type okay2 []nih
type okay3 func(x nih) nih
type okay4 interface {
f(x nih) nih
}
func f() {
type embed7 map[nih]int // ERROR "incomplete \(or unallocatable\) map key not allowed"
type embed8 map[int]nih // ERROR "incomplete \(or unallocatable\) map value not allowed"
type emebd9 chan nih // ERROR "chan of incomplete \(or unallocatable\) type not allowed"
}