<div dir="ltr">Hello,<div>I'm working on C++ interpreter that uses APSInt type to represent integers. I've just spent an hour debugging a bug the cause of which was unintuitive APSInt behavior / method signature.</div><div><br></div><div>APSInt assignments are declared as follows:</div><div><br></div><div><div>class LLVM_NODISCARD APSInt : public APInt {</div><div>...</div><div>  APSInt &operator=(APInt RHS) {<br></div><div><b>    // Retain our current sign.</b></div><div>    APInt::operator=(std::move(RHS));</div><div>    return *this;</div><div>  }</div><div><br></div><div>  APSInt &operator=(uint64_t RHS) {</div><div><b>    // Retain our current sign.</b></div><div>    APInt::operator=(RHS);</div><div>    return *this;</div><div>  }</div></div><div>...</div><div>};</div><div><br></div><div>By looking into header one may think that assignment <b>always retains the sign. </b>But this is not true, because automatically generated copy assignment will copy sign from RHS.</div><div><br></div><div>-Roman</div></div>