Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types2: no type reported for argument to unsafe.OffsetOf #47895

Closed
griesemer opened this issue Aug 22, 2021 · 2 comments
Closed

types2: no type reported for argument to unsafe.OffsetOf #47895

griesemer opened this issue Aug 22, 2021 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

Test case provided by @danscales :

package p

import "unsafe"

type Tstruct[T any] struct {
	f1 T
	f2 int
}

func (r *Tstruct[T]) offset() uintptr {
	return unsafe.Offsetof(r.f2)
}

types2.Info doesn't report a type for r.f2.

@griesemer griesemer added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 22, 2021
@griesemer griesemer added this to the Go1.18 milestone Aug 22, 2021
@griesemer griesemer self-assigned this Aug 22, 2021
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/344252 mentions this issue: cmd/compile/internal/types2: report argument type for unsafe.OffsetOf

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/344254 mentions this issue: go/types: report argument type for unsafe.OffsetOf

gopherbot pushed a commit that referenced this issue Aug 22, 2021
This is a clean port of CL 344252 to go/types.

For #47895.

Change-Id: I48cbb97ec28fcfb4fdf483594be9d29426c117ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/344254
Trust: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants