mirror of
https://github.com/golang/go
synced 2024-11-08 18:46:16 -07:00
706b54bb85
It was possible that var X interface{} = 'x' could cause a compilation failure due to having not calculated rune's width yet. typecheck.go normally calculates the width of things, but it doesn't for implicit conversions to default type. We already compute the width of all of the standard numeric types in universe.go, but we failed to calculate it for the rune alias type. So we could later crash if the code never otherwise explicitly mentioned 'rune'. While here, explicitly compute widths for 'byte' and 'error' for consistency. Fixes #29350. Change-Id: Ifedd4899527c983ee5258dcf75aaf635b6f812f8 Reviewed-on: https://go-review.googlesource.com/c/155380 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Robert Griesemer <gri@golang.org>
10 lines
207 B
Go
10 lines
207 B
Go
// compile
|
|
|
|
// Copyright 2018 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 X interface{} = 'x'
|