https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66374

            Bug ID: 66374
           Summary: template function accessing a temporary through a
                    lambda
           Product: gcc
           Version: 5.1.1
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: major
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sebastien.alaiwan at gmail dot com
  Target Milestone: ---

The following C++ snippet used to compile, but doesn't anymore with current gcc
trunk.

-----------------
// simple.cpp
int getValueOfSix()
{
  return 6;
}

template<int A>
void f()
{
  auto const c = getValueOfSix();

  auto lambda = [&] ()
  {
    auto a = c;
    auto b = c;
  };
}

void g()
{
  f<0>();
}

Reply via email to