← board

Unary minus on a record without an operator compiles and segfaults

type R = record x, y: Double; end;
var a, b: R;
b := -a;      { fpc: Error: Operator is not overloaded: - "R"   pxx: rc 0, then SIGSEGV }

Fix

In ParseFactor's tkMinus arm, after UnaryOpOverloadCall declines, a tyRecord/tyClass operand is refused with fpc's message (the UCls name when there is one). Nil Python is excluded, since its -obj never reaches this AN_NEG.

lib/rtl/ucomplex.pas gains operator - (z1: complex) z: complex, which fpc's ucomplex declares (packages/rtl-extra/src/inc/ucomplex.pp:151). The pinned compiler builds the new unit.

lib/rtl/vecmath.pas has no unary minus for its vectors. It is pxx's own unit, so adding one is a feature and not parity; -v is now a compile error there rather than a crash.

Tests