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

Douglas Gregor dgregor at apple.com
Wed Oct 6 07:55:23 PDT 2010


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. Caught-exception copies could do the same, although I admit that it isn't quite as natural there.

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. If we're going to have a special expression node kind for type-checking purposes, I'd rather that it never make its way into the AST, and perhaps make it impossible to allocate it on the heap, so that it can be ignored by everything else (e.g., serialization, checker, codegen). 

	- Doug



More information about the cfe-commits mailing list