[cfe-commits] [Patch review request] Binary type traits

John McCall rjmccall at apple.com
Wed Oct 6 09:36:03 PDT 2010


On Oct 6, 2010, at 7:55 AM, Douglas Gregor wrote:

> 
> On Sep 27, 2010, at 5:56 AM, John McCall wrote:
> 
>> On Sep 20, 2010, at 6:30 PM, Douglas Gregor wrote:
>>> I'd really rather not add a new expression type just for the purpose of type-checking __is_convertible_to. How about we synthesize appropriate expressions instead, e.g., a DeclRefExpr to a synthesized variable, or a CallExpr to a synthesized function with an appropriate return type?
>> 
>> Actually, I think there are several places in the AST where "opaque expression of fixed type and l-valueness" would be very convenient — mostly with copies, e.g. with synthesized array copies, caught-exception copies, etc.
> 
> Synthesized array copies always have a parameter to hang on to.

Right, but we end up synthesizing array index variables.  I'm suggesting this as a general alternative to making a reference to a synthesized variable.

> I'm on the fence. I don't like having expression nodes that don't represent ideas in the language, but there is some messiness in the expression synthesis we do in Sema.

I'm just saying that there are several places in the language where values come from no intrinsically-expressible place, and while it's obviously always possible to fake up expressions with the right properties in terms of spurious variables, I'm not sure I accept that that's somehow inherently cleaner than having a pair of expressions for "this opaque value comes from some place that the context knows about" and "the sub-expression needs these opaque values to work".  I'm basically suggesting specialized lambdas. :)  They'd definitely be constrained to a few places in the AST, though.

John.



More information about the cfe-commits mailing list