mirror of
https://github.com/golang/go
synced 2024-09-18 15:32:18 +00:00
5c42b6a953
This CL includes multiple test cases that exercise unique failures with -G=3 mode that did not affect unified IR mode. Most of these were found over a period of about 3 hours of manual experimentation. Thanks to Cuong Manh Le for test cases 11 and 12. Updates #46704. Change-Id: Ia2fa619536732b121b6c929329065c85b9384511 Reviewed-on: https://go-review.googlesource.com/c/go/+/326169 Trust: Matthew Dempsky <mdempsky@google.com> Trust: Dan Scales <danscales@google.com> Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com> Reviewed-by: Robert Griesemer <gri@golang.org>
39 lines
677 B
Go
39 lines
677 B
Go
// run -gcflags=-G=3
|
|
|
|
// Copyright 2021 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 main
|
|
|
|
type Mer interface{ M() }
|
|
|
|
func F[T Mer](expectPanic bool) {
|
|
defer func() {
|
|
err := recover()
|
|
if (err != nil) != expectPanic {
|
|
print("FAIL: (", err, " != nil) != ", expectPanic, "\n")
|
|
}
|
|
}()
|
|
|
|
var t T
|
|
T.M(t)
|
|
}
|
|
|
|
type MyMer int
|
|
|
|
func (MyMer) M() {}
|
|
|
|
func main() {
|
|
F[Mer](true)
|
|
F[struct{ Mer }](true)
|
|
F[*struct{ Mer }](true)
|
|
|
|
F[MyMer](false)
|
|
F[*MyMer](true)
|
|
F[struct{ MyMer }](false)
|
|
F[struct{ *MyMer }](true)
|
|
F[*struct{ MyMer }](true)
|
|
F[*struct{ *MyMer }](true)
|
|
}
|