1
0
mirror of https://github.com/golang/go synced 2024-11-17 01:04:50 -07:00

cmd/compile: emit definition of 'any' only if generic enabled

CL 364377 emitted definition of 'any' when compiling runtime. But 'any'
is only available when generic enabled. Thus emitting its definition
unconditionally causes the compiler crashes.

Updates #49619

Change-Id: I0888ca1cbc7a7df300310a99a344f170636333f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/364614
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
This commit is contained in:
Cuong Manh Le 2021-11-17 10:17:31 +07:00
parent 03dd049d6e
commit 1d004fa201
2 changed files with 4 additions and 2 deletions

View File

@ -1384,7 +1384,9 @@ func WriteBasicTypes() {
}
writeType(types.NewPtr(types.Types[types.TSTRING]))
writeType(types.NewPtr(types.Types[types.TUNSAFEPTR]))
writeType(types.AnyType)
if base.Flag.G > 0 {
writeType(types.AnyType)
}
// emit type structs for error and func(error) string.
// The latter is the type of an auto-generated wrapper.

View File

@ -1,4 +1,4 @@
// build
// build -gcflags=-G=3
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style