diff --git a/go/types/return.go b/go/types/return.go index ad5b22d0..fb8ab6dc 100644 --- a/go/types/return.go +++ b/go/types/return.go @@ -28,8 +28,8 @@ func (check *checker) isTerminating(s ast.Stmt, label string) bool { return check.isTerminating(s.Stmt, s.Label.Name) case *ast.ExprStmt: - // the predeclared panic() function is terminating - if call, _ := s.X.(*ast.CallExpr); call != nil { + // the predeclared (possibly parenthesized) panic() function is terminating + if call, _ := unparen(s.X).(*ast.CallExpr); call != nil { if id, _ := call.Fun.(*ast.Ident); id != nil { if obj := check.topScope.LookupParent(id.Name); obj != nil { if b, _ := obj.(*Builtin); b != nil && b.id == _Panic { diff --git a/go/types/testdata/stmt1.src b/go/types/testdata/stmt1.src index 537c3f4a..a2955e6f 100644 --- a/go/types/testdata/stmt1.src +++ b/go/types/testdata/stmt1.src @@ -11,6 +11,7 @@ func _() {} func _() int {} /* ERROR "missing return" */ func _() int { panic(0) } +func _() int { (panic(0)) } // block statements func _(x, y int) (z int) {