From: Andrew Wilkins Date: Tue, 19 Feb 2013 03:03:10 +0000 (-0800) Subject: go/types: Permit dereferencing of named pointer types. X-Git-Tag: go1.1rc2~977 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=68ff170ebece48b7fbef3c14c1514811a4d6c370;p=gostls13.git go/types: Permit dereferencing of named pointer types. R=golang-dev, gri CC=golang-dev https://golang.org/cl/7358044 --- diff --git a/src/pkg/go/types/expr.go b/src/pkg/go/types/expr.go index 696a0cae68..0caa90a1d3 100644 --- a/src/pkg/go/types/expr.go +++ b/src/pkg/go/types/expr.go @@ -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 { diff --git a/src/pkg/go/types/testdata/expr0.src b/src/pkg/go/types/testdata/expr0.src index c3233d36fe..8d057f63c1 100644 --- a/src/pkg/go/types/testdata/expr0.src +++ b/src/pkg/go/types/testdata/expr0.src @@ -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 +) +