modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue15039.go (about)

     1  // run
     2  
     3  // Copyright 2016 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  package main
     8  
     9  func main() {
    10  	const fffd = "\uFFFD"
    11  
    12  	// runtime.intstring used to convert int64 to rune without checking
    13  	// for truncation.
    14  	u := uint64(0x10001f4a9)
    15  	big := string(u)
    16  	if big != fffd {
    17  		panic("big != bad")
    18  	}
    19  
    20  	// cmd/compile used to require integer constants to fit into an "int".
    21  	const huge = string(1<<100)
    22  	if huge != fffd {
    23  		panic("huge != bad")
    24  	}
    25  }