diff --git a/compiler/compiler.go b/compiler/compiler.go index 1a56c98c..816f91d8 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -2225,7 +2225,7 @@ func (c *Compiler) parseExpr(frame *Frame, expr ssa.Value) (llvm.Value, error) { if err != nil { return llvm.Value{}, err } - return c.parseBinOp(expr.Op, expr.X.Type().Underlying(), x, y) + return c.parseBinOp(expr.Op, expr.X.Type(), x, y) case *ssa.Call: // Passing the current task here to the subroutine. It is only used when // the subroutine is blocking. @@ -2711,7 +2711,7 @@ func (c *Compiler) parseExpr(frame *Frame, expr ssa.Value) (llvm.Value, error) { } func (c *Compiler) parseBinOp(op token.Token, typ types.Type, x, y llvm.Value) (llvm.Value, error) { - switch typ := typ.(type) { + switch typ := typ.Underlying().(type) { case *types.Basic: if typ.Info()&types.IsInteger != 0 { // Operations on integers diff --git a/testdata/binop.go b/testdata/binop.go index 64a33953..e98545f9 100644 --- a/testdata/binop.go +++ b/testdata/binop.go @@ -58,8 +58,10 @@ var s2 = Struct2{"foo", 0.0, 5} var a1 = [2]int{1, 2} +type Int int + type Struct1 struct { - i int + i Int b bool }