[cfe-dev] Doubt about AST

Douglas Gregor dgregor at apple.com
Thu Jun 17 08:47:18 PDT 2010


On Jun 17, 2010, at 8:39 AM, Douglas Gregor wrote:

> 
> On Jun 17, 2010, at 4:43 AM, Abramo Bagnara wrote:
> 
>> I'd like also to understand in which situations clang choose to emit
>> something like BinaryOperator (then instantiated in operator call) and
>> when choose to emit an operator call also on primary template (of course
>> when both choices might be done).
> 
> In non-dependent cases, BinaryOperator is for builtin types and CXXOperatorCallExpr is for uses of overloaded operators. 
> 
> In dependent cases, we use CXXOperatorCallExpr when name lookup has found overloaded operators in the current scope, because we need to save those overloaded operators until instantiation time. (These are results from the first "phase" of two-phase name lookup). If no overloaded operators were found, we use BinaryOperator instead.
> 
> UnaryOperator should be doing the same thing here... so yes, there's a bug here :)

Fixed in r106222.

I didn't try to teach Clang about the return type of *this when 'this' is dependent. It's not clear that we're actually allowed by the standard to do such a thing.

	- Doug



More information about the cfe-dev mailing list