This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/71386] Wrong code on c++14 (GCC trunk)


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]