f8d9fa9e80
This upgrades all of libgo other than the runtime package to the Go 1.4 release. In Go 1.4 much of the runtime was rewritten into Go. Merging that code will take more time and will not change the API, so I'm putting it off for now. There are a few runtime changes anyhow, to accomodate other packages that rely on minor modifications to the runtime support. The compiler changes slightly to add a one-bit flag to each type descriptor kind that is stored directly in an interface, which for gccgo is currently only pointer types. Another one-bit flag (gcprog) is reserved because it is used by the gc compiler, but gccgo does not currently use it. There is another error check in the compiler since I ran across it during testing. gotools/: * Makefile.am (go_cmd_go_files): Sort entries. Add generate.go. * Makefile.in: Rebuild. From-SVN: r219627
77 lines
1.1 KiB
Plaintext
77 lines
1.1 KiB
Plaintext
//gofmt -r=(x)->x
|
|
|
|
// Copyright 2012 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.
|
|
|
|
// Rewriting of parenthesized expressions (x) -> x
|
|
// must not drop parentheses if that would lead to
|
|
// wrong association of the operands.
|
|
// Was issue 1847.
|
|
|
|
package main
|
|
|
|
// From example 1 of issue 1847.
|
|
func _() {
|
|
var t = (&T{1000}).Id()
|
|
}
|
|
|
|
// From example 2 of issue 1847.
|
|
func _() {
|
|
fmt.Println((*xpp).a)
|
|
}
|
|
|
|
// Some more test cases.
|
|
func _() {
|
|
_ = (-x).f
|
|
_ = (*x).f
|
|
_ = (&x).f
|
|
_ = (!x).f
|
|
_ = (-x.f)
|
|
_ = (*x.f)
|
|
_ = (&x.f)
|
|
_ = (!x.f)
|
|
(-x).f()
|
|
(*x).f()
|
|
(&x).f()
|
|
(!x).f()
|
|
_ = (-x.f())
|
|
_ = (*x.f())
|
|
_ = (&x.f())
|
|
_ = (!x.f())
|
|
|
|
_ = ((-x)).f
|
|
_ = ((*x)).f
|
|
_ = ((&x)).f
|
|
_ = ((!x)).f
|
|
_ = ((-x.f))
|
|
_ = ((*x.f))
|
|
_ = ((&x.f))
|
|
_ = ((!x.f))
|
|
((-x)).f()
|
|
((*x)).f()
|
|
((&x)).f()
|
|
((!x)).f()
|
|
_ = ((-x.f()))
|
|
_ = ((*x.f()))
|
|
_ = ((&x.f()))
|
|
_ = ((!x.f()))
|
|
|
|
_ = -(x).f
|
|
_ = *(x).f
|
|
_ = &(x).f
|
|
_ = !(x).f
|
|
_ = -x.f
|
|
_ = *x.f
|
|
_ = &x.f
|
|
_ = !x.f
|
|
_ = -(x).f()
|
|
_ = *(x).f()
|
|
_ = &(x).f()
|
|
_ = !(x).f()
|
|
_ = -x.f()
|
|
_ = *x.f()
|
|
_ = &x.f()
|
|
_ = !x.f()
|
|
}
|