[Bug c++/56567] [4.8 Regression] ICE with lambda return type deduction and braced-init-list

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 11 03:22:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56567

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-11 03:21:52 UTC ---
(In reply to comment #4)
> It's certainly legal to compile a function returning an std::initializer list,
> which is never called. So this fix is problematic. For example
> 
> []{ return std::initializer_list< int >{ 1, 2 }; }();

That's a good point, though returning an initializer_list value is completely
useless; since the underlying array is local to the returning function, any use
of the returned value would cause undefined behavior, just like returning a
reference to a local variable.



More information about the Gcc-bugs mailing list