This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Maintain ellipsis location when transforming lambda captures
ClosedPublic

Authored by meadori on Jun 20 2015, 7:17 PM.

Details

Summary

This patch fixes a crash caused by the following case:

template<typename T>
auto f(T x) {
  auto g = [](auto ... args) {
    auto h = [args...]() -> int {
      return 0;
    };
    return h;
  };
  return g;
}

auto x = f(0)();

When the templated function 'f' is instantiated and the inner-most
lambda is transformed the ellipsis location on the captured variable
is lost. Then the lambda returned by 'f' is instantiated and the
tree transformer chokes on the invalid ellipsis location. The
problem is fixed by making a minor change to properly track the
ellipsis location.

This fixes PR23716.

Diff Detail

Repository
rL LLVM

Event Timeline

meadori updated this revision to Diff 28083.Jun 20 2015, 7:17 PM
meadori retitled this revision from to [Sema] Maintain ellipsis location when transforming lambda captures.
meadori updated this object.
meadori edited the test plan for this revision. (Show Details)
meadori added a reviewer: rsmith.
meadori added a subscriber: Unknown Object (MLST).
meadori updated this revision to Diff 28084.Jun 20 2015, 7:21 PM
meadori removed a subscriber: Unknown Object (MLST).
meadori added a subscriber: Unknown Object (MLST).
rsmith accepted this revision.Jun 25 2015, 2:03 PM
rsmith edited edge metadata.

LGTM, thanks

This revision is now accepted and ready to land.Jun 25 2015, 2:03 PM
This revision was automatically updated to reflect the committed changes.