aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2020-10-19 14:14:40 -0700
committerMatthew Dempsky <mdempsky@google.com>2020-10-19 21:30:43 +0000
commitc216ae80c965acb9641d94d5f58c206bd0cf7d66 (patch)
treeb2c07946fb284f176dc5c6c8c24a65bb517df44a /test
parent5647d01ab724a19793ac7002776b0dec03fa35f5 (diff)
downloadgo-c216ae80c965acb9641d94d5f58c206bd0cf7d66.tar.gz
go-c216ae80c965acb9641d94d5f58c206bd0cf7d66.zip
cmd/compile: fix ICE in reporting of invalid recursive types
asNode(t.Nod).Name.Param will be nil for builtin types (i.e., the universal predeclared types and unsafe.Pointer). These types can't be part of a cycle anyway, so we can just skip them. Fixes #42075. Change-Id: Ic7a44de65c6bfd16936545dee25e36de8850acf3 Reviewed-on: https://go-review.googlesource.com/c/go/+/263717 Trust: Matthew Dempsky <mdempsky@google.com> Trust: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Diffstat (limited to 'test')
-rw-r--r--test/fixedbugs/issue42075.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/fixedbugs/issue42075.go b/test/fixedbugs/issue42075.go
new file mode 100644
index 0000000000..af85fb281d
--- /dev/null
+++ b/test/fixedbugs/issue42075.go
@@ -0,0 +1,16 @@
+// errorcheck
+
+// Copyright 2020 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
+
+import "unsafe"
+
+type T struct { // ERROR "recursive type"
+ x int
+ p unsafe.Pointer
+
+ f T
+}