<div dir="ltr"><div dir="ltr">On Wed, 9 Jun 2021 at 23:18, Stephan Bergmann via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I now see that I had accidentally sent the below to llvm-dev rather than <br>
cfe-dev. (Also, see the comments at <br>
<<a href="https://reviews.llvm.org/D103949#2808256" rel="noreferrer" target="_blank">https://reviews.llvm.org/D103949#2808256</a>> "Only consider built-in <br>
compound assignment operators for -Wunused-but-set-*" for the place <br>
where this questions came up.)<br>
<br>
On 04/06/2021 09:54, Stephan Bergmann wrote:<br>
> Ever since <br>
> <<a href="https://github.com/llvm/llvm-project/commit/d2b7ef6ecea967b70bdeb8a1fd8004c5aef3e415" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/d2b7ef6ecea967b70bdeb8a1fd8004c5aef3e415</a>> <br>
> "Improve the representation of operator expressions like "x + y" within <br>
> C++ templates", the documentation of BinaryOperator <br>
> (clang/include/clang/AST/Expr.h) and CXXOperatorCallExpr <br>
> (clang/include/clang/AST/ExprCXX.h) claim that if any of an operator's <br>
> arguments are type-dependent, it is represented with <br>
> CXXOperatorCallExpr. However,<br>
> <br>
>> template<typename T> void f(T x) {<br>
>> int n;<br>
>> x + n;<br>
>> x += n;<br>
>> }<br>
>> #pragma clang __debug dump f<br>
> <br>
> shows both + and += to use BinaryOperator (derived <br>
> CompoundAssignOperator for +=).<br>
> <br>
> Anything I'm missing?<br></blockquote><div><br></div><div>That looks like a documentation bug to me. I believe the actual rule is that CXXOperatorCallExpr is used if there is an associated set of functions (because either the operator has been resolved to a specific function or the operator is dependent and unqualified lookup found any potential function candidates), and BinaryOperator is used if there are no associated functions (because either the operator was resolved to a builtin operator or the operator is dependent and unqualified lookup found nothing).</div></div></div>