Make sure to perform dependent access checks when instantiating a
lambda-expression. We don't actually instantiate the closure type / operator()
in the template in order to produce the closure type / operator() in the
instantiation, so this isn't caught by the normal path.
llvm-svn: 264184
diff --git a/clang/test/SemaCXX/access.cpp b/clang/test/SemaCXX/access.cpp
index 5fa1509..cd65f90 100644
--- a/clang/test/SemaCXX/access.cpp
+++ b/clang/test/SemaCXX/access.cpp
@@ -158,3 +158,14 @@
int array[sizeof(test::private_struct)]; // expected-error {{private}}
}
+
+namespace ThisLambdaIsNotMyFriend {
+ class A {
+ friend class D;
+ static void foo(); // expected-note {{here}}
+ };
+ template <class T> void foo() {
+ []() { A::foo(); }(); // expected-error {{private}}
+ }
+ void bar() { foo<void>(); } // expected-note {{instantiation}}
+}