+
Skip to content

Add object sensitivity to struct field handling #339

@sonalmahajan15

Description

@sonalmahajan15
type S struct {
	Field *int
}

func f1() *S {
	s := &S{}
	s.Field = nil
        return s
}

func f2() {
	s := &S{Field: new(int)}
        return s
}

func test() {
        s1 := f1()
	print(*s1.Field) // report error here

        s2 := f2()
	print(*s2.Field) // safe
}


Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载