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