aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/compiler/check.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/compiler/check.go')
-rw-r--r--pkg/compiler/check.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/compiler/check.go b/pkg/compiler/check.go
index 0b296e2ea..24acfe50f 100644
--- a/pkg/compiler/check.go
+++ b/pkg/compiler/check.go
@@ -415,7 +415,12 @@ func (comp *compiler) checkLenTargetRec(t0, t *ast.Type, targets []*ast.Type,
parent := parents[pi]
if parent.name != "" && (parent.name == target.Ident || target.Ident == prog.ParentRef) ||
parent.name == "" && target.Ident == prog.SyscallRef {
- if len(targets) != 0 {
+ if len(targets) == 0 {
+ if t.Ident == "offsetof" {
+ comp.error(target.Pos, "%v must refer to fields", t.Ident)
+ return
+ }
+ } else {
parents1 := make([]parentDesc, pi+1)
copy(parents1, parents[:pi+1])
comp.checkLenTargetRec(t0, t, targets, parents1, warned)