[cfe-dev] OpenCL vec_step feature implementation - Updated

Peter Collingbourne peter at pcc.me.uk
Wed Feb 16 08:21:54 PST 2011

On Wed, Feb 16, 2011 at 02:36:21PM -0000, Anton Lokhmotov wrote:
> Aside: While I'm not aware of any binary type property expressions, I guess
> there could be an operator, say, is_compatible(type1, type2) returning true
> if type1 is in some sense "compatible" with type2 and false otherwise.  For
> example, if "compatible" would mean "type1 can be implicitly converted to
> type2", for OpenCL is_compatible(int4, int4) would return true and
> is_compatible(int4, uint4) would return false.  Currently this is only of
> theoretical interest of course :).

There is __builtin_types_compatible_p which is represented by
a BinaryTypeTraitExpr in Clang.  The *TypeTraitExpr classes are
specialised for boolean results, so I suppose a BinaryTypePropertyExpr
would take two types and produce a non-boolean result, but I cannot
personally think of a situation where this would be a good idea.


More information about the cfe-dev mailing list