]> granicus.if.org Git - clang/commit
Fix for PR18052 - Lambdas within NSDMI's and default arguments in Nested classes.
authorFaisal Vali <faisalv@yahoo.com>
Wed, 4 Dec 2013 22:43:08 +0000 (22:43 +0000)
committerFaisal Vali <faisalv@yahoo.com>
Wed, 4 Dec 2013 22:43:08 +0000 (22:43 +0000)
commit48b59b2e1561fdb52cd3b6e1a57ac559808125cb
tree8690653ce2ca366ddeedf21a7e94dc2fe4e35ef8
parentdb218b62f65f84d8bf608b15c81c7f70b530baaf
Fix for PR18052 - Lambdas within NSDMI's and default arguments in Nested classes.

Clang currently croaks on the following:
  struct X1 {
    struct X2 {
      int L = ([] (int i) { return i; })(2);
    };
  };

asserting that the containing lexical context of the lambda is not Sema's cur context, when pushing the lambda's decl context on.

This occurs because (prior to this patch) getContainingDC always returns the non-nested class for functions at class scope (even for inline member functions of nested classes (to account for delayed parsing of their bodies)).  The patch addresses this by having getContainingDC always return the lexical DC for a lambda's call operator.

Link to the bug: http://llvm.org/bugs/show_bug.cgi?id=18052
Link to Richard Smith's feedback on phabricator: http://llvm-reviews.chandlerc.com/D2331

Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196423 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaDecl.cpp
test/SemaCXX/cxx1y-generic-lambdas.cpp