diff options
| author | Keith Randall <khr@golang.org> | 2022-02-25 16:06:53 -0800 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2022-02-28 15:50:51 +0000 |
| commit | 0907d57abf34e1d11debef2ea7bb4d7b2c11f51e (patch) | |
| tree | 85158cda21e56415d093676299efebcbfaedab84 /test/typeparam | |
| parent | 9c4a8620c802fbb03545e401c41f11d622b84b42 (diff) | |
| download | go-0907d57abf34e1d11debef2ea7bb4d7b2c11f51e.tar.xz | |
cmd/compile: emit types of constants which are instantiated generic types
Normally types of constants are emitted when the type is defined (an
ODCLTYPE). However, the types of constants where the type is an
instantiated generic type made inside the constant declaration, do not
normally get emitted. But the DWARF processor in the linker wants
to see those types. So we emit them during stenciling.
Fixes #51245
Change-Id: I59f20f1d7b91501c9ac760cf839a354356331fc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/388117
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'test/typeparam')
| -rw-r--r-- | test/typeparam/issue51245.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/typeparam/issue51245.go b/test/typeparam/issue51245.go new file mode 100644 index 0000000000..bd4f7c5dc9 --- /dev/null +++ b/test/typeparam/issue51245.go @@ -0,0 +1,16 @@ +// build -gcflags=-G=3 + +// Copyright 2022 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 T[P any] int +const C T[int] = 3 + +type T2 int +const C2 T2 = 9 + +func main() { +} |
