xref: /llvm-project/clang-tools-extra/test/clang-change-namespace/lambda-function.cpp (revision 5f5a74582f8abb2935f9a6f6df3a55dc825f5412)
1*5f5a7458SNico Weber // RUN: clang-change-namespace -old_namespace "na::nb" -new_namespace "x::y" --file_pattern ".*" %s -- -std=c++11 | sed 's,// CHECK.*,,' | FileCheck %s
2*5f5a7458SNico Weber 
3*5f5a7458SNico Weber template <class T>
4*5f5a7458SNico Weber class function;
5*5f5a7458SNico Weber template <class R, class... ArgTypes>
6*5f5a7458SNico Weber class function<R(ArgTypes...)> {
7*5f5a7458SNico Weber public:
8*5f5a7458SNico Weber   template <typename Functor>
function(Functor f)9*5f5a7458SNico Weber   function(Functor f) {}
operator ()(ArgTypes...) const10*5f5a7458SNico Weber   R operator()(ArgTypes...) const {}
11*5f5a7458SNico Weber };
12*5f5a7458SNico Weber 
13*5f5a7458SNico Weber namespace x {
14*5f5a7458SNico Weber // CHECK: namespace x {
15*5f5a7458SNico Weber class X {};
16*5f5a7458SNico Weber }
17*5f5a7458SNico Weber 
18*5f5a7458SNico Weber namespace na {
19*5f5a7458SNico Weber namespace nb {
20*5f5a7458SNico Weber // CHECK: namespace x {
21*5f5a7458SNico Weber // CHECK-NEXT: namespace y {
f(function<void (int)> func,int param)22*5f5a7458SNico Weber void f(function<void(int)> func, int param) { func(param); }
__anonae7d723a0102(int x) 23*5f5a7458SNico Weber void g() { f([](int x) {}, 1); }
24*5f5a7458SNico Weber 
25*5f5a7458SNico Weber // x::X in function type parameter list will have translation unit context, so
26*5f5a7458SNico Weber // we simply replace it with fully-qualified name.
27*5f5a7458SNico Weber using TX = function<x::X(x::X)>;
28*5f5a7458SNico Weber // CHECK: using TX = function<X(x::X)>;
29*5f5a7458SNico Weber 
30*5f5a7458SNico Weber class A {};
31*5f5a7458SNico Weber using TA = function<A(A)>;
32*5f5a7458SNico Weber // CHECK: using TA = function<A(A)>;
33*5f5a7458SNico Weber 
34*5f5a7458SNico Weber // CHECK: } // namespace y
35*5f5a7458SNico Weber // CHECK-NEXT: } // namespace x
36*5f5a7458SNico Weber }
37*5f5a7458SNico Weber }
38