This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71386] Wrong code on c++14 (GCC trunk)
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 26 Jun 2016 10:41:35 +0000
- Subject: [Bug c++/71386] Wrong code on c++14 (GCC trunk)
- Auto-submitted: auto-generated
- References: <bug-71386-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71386
--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> ---
Slightly simpler
template<class...XS>
auto List(XS...xs)
{
return [=](auto processList){return processList(xs...);};
};
auto l1 = List(42);
auto foo = [](auto... xs1)
{
return [=]()
{
return l1([=](auto)
{
return __builtin_printf("%d",xs1...);
});
};
};
int main()
{
auto concat = l1(foo);
concat();
__builtin_printf("\n");
}
If I make xs1 non-variadic (just erase '...' in 2 places), things work. The
main difference seems to be in <lambda(auto:2 ...)> [with auto:2 = {int}] (we
write to some place in the stack then re-read the value from another place) but
it isn't clear what is going wrong there.