[Bug c++/50431] [C++0x] bug in def array size with a lambda
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 16 14:01:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50431
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-16 13:47:49 UTC ---
(In reply to comment #2)
> BUG1:
> auto sz = []()->constexpr long { return 100L; };
> int arr[sz()];
>
> Why constexpr for lambda won't be compiled? Can i not use auto type for a
> lambda variant?
The closure type's function call operator can be const but not constexpr.
You can use auto for a lambda, you just can't have a constexpr lambda.
Why do you want it to work?
What advantage is there to using a lambda instead of named function? e.g.
constexpr long sz() { return 100L; };
int arr[sz()];
More information about the Gcc-bugs
mailing list