Commit 68ff170e authored by Andrew Wilkins's avatar Andrew Wilkins Committed by Robert Griesemer

go/types: Permit dereferencing of named pointer types.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/7358044
parent 95aaca67
......@@ -1193,7 +1193,7 @@ func (check *checker) rawExpr(x *operand, e ast.Expr, hint Type, iota int, cycle
case typexpr:
x.typ = &Pointer{Base: x.typ}
default:
if typ, ok := x.typ.(*Pointer); ok {
if typ, ok := underlying(x.typ).(*Pointer); ok {
x.mode = variable
x.typ = typ.Base
} else {
......
......@@ -149,3 +149,13 @@ var (
_ = &((((T{1, 2}))))
_ = &f /* ERROR "cannot take address" */ ()
)
// recursive pointer types
type P *P
var (
p1 P = new(P)
p2 P = *p1
p3 P = &p2
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment