Commit ee2f5faf authored by Robert Griesemer's avatar Robert Griesemer

cmd/compile/internal/parser: don't crash after unexpected token

Added missing nil-check. We will get rid of the gcCompat corrections
shortly but it's still worthwhile having the new test case added.

Fixes #19056.

Change-Id: I35bd938a4d789058da15724e34c05e5e631ecad0
Reviewed-on: https://go-review.googlesource.com/36908
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
parent 8da91a62
......@@ -799,7 +799,7 @@ loop:
p.syntax_error("expecting name or (")
p.advance(_Semi, _Rparen)
}
if gcCompat {
if gcCompat && x != nil {
x.init(p)
}
......
// errorcheck
// Copyright 2017 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
var _ = ... . // ERROR "unexpected ..."
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment