1// Copyright 2023 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Test cases for symbol name mangling. 6 7package main 8 9import ( 10 "fmt" 11 "strings" 12) 13 14// Issue 58800: 15// Instantiated function name may contain weird characters 16// that confuse the external linker, so it needs to be 17// mangled. 18type S struct { 19 X int `parser:"|@@)"` 20} 21 22//go:noinline 23func F[T any]() {} 24 25func P() { 26 F[S]() 27} 28 29// Issue 62098: the name mangling code doesn't handle some string 30// symbols correctly. 31func G(id string) error { 32 if strings.ContainsAny(id, "&$@;/:+,?\\{^}%`]\">[~<#|") { 33 return fmt.Errorf("invalid") 34 } 35 return nil 36} 37 38func main() {} 39