[Bug c++/53097] [c++0x] Missed optimization: lambda closure object could be smaller
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Apr 24 01:46:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53097
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-04-24
Ever Confirmed|0 |1
Severity|normal |enhancement
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-04-24 01:45:51 UTC ---
The easy way to implement this would be something like:
include <stdio.h>
int main(int argc, char **argv)
{
struct {
int a, b;
};
auto foo = [&](){return a + b;};
printf("%d\n", (int)sizeof(foo));
return 0;
}
and then only the pointer to the struct needs to be done for the closure.
More information about the Gcc-bugs
mailing list