patch: new attribute enable_if

Nick Lewycky nicholas at
Sun Sep 22 03:44:55 PDT 2013

Nick Lewycky wrote:
> The attached patch adds a new attribute named "enable_if" which takes an
> expression and a string. At the call site, the arguments are substituted
> into the enable_if expression (which is written in terms of the
> parameters) to determine whether this function is a viable candidate.
> Please review!

I forgot to mention. This patch implements the parse+sema, but there 
will need to be a follow-up patch to make this useful in C++ mode 
(without using __asm__). We'll need to mangle the enable_if expression 
into the name, but I don't have a good mangling for that. The ABI does 
provide ways to encode vendor extensions, but there's no way to indicate 
that the vendor-extension should be demangled as an expression. It's a 
problem for a future patch.


More information about the cfe-commits mailing list