[cfe-dev] GNU attributes in lambda expressions?

Eric Christopher echristo at apple.com
Mon Jun 25 15:10:17 PDT 2012


On Jun 25, 2012, at 3:08 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> On Mon, Jun 25, 2012 at 2:25 PM, Eric Christopher <echristo at apple.com> wrote:
> 
> On Jun 5, 2012, at 5:06 PM, "Sharlet, Dillon" <dillon.sharlet at intel.com> wrote:
> 
> > Hello All,
> >
> > First of all, thank you all very much for implementing lambda expressions in Clang 3.1! This is a much anticipated feature and I greatly appreciate the work to implement this.
> >
> > I have a small suggestion for lambdas expressions: How about supporting GNU attributes (__attribute__) in the attribute list of a lambda expression? I’m no clang ninja so I can’t say if what I did is stable/solid, but I was able to add the support I needed for this pretty easily using the handy ParseGNUAttributes function. The lambda parser already parses some attributes, so maybe this is simply an accidental omission?
> >
> 
> It's not impossible... but why?
> 
> I assume primarily for GCC compatibility. GCC accepts this, for instance:
> 
>   auto x = [] () __attribute__((noreturn)) {};

Cool. I was wondering which attributes were wanted, that one seems to make sense. I guess nothrow etc as well.

-eric



More information about the cfe-dev mailing list