133 lines · cpp
1#include <stdio.h>2#include <stdint.h>3 4namespace a {5 class c {6 public:7 c();8 ~c();9 void func1() 10 {11 puts (__PRETTY_FUNCTION__);12 }13 void func2() 14 {15 puts (__PRETTY_FUNCTION__);16 }17 void func3() 18 {19 puts (__PRETTY_FUNCTION__);20 }21 };22 23 c::c() {}24 c::~c() {}25}26 27namespace aa {28 class cc {29 public:30 cc();31 ~cc();32 void func1() 33 {34 puts (__PRETTY_FUNCTION__);35 }36 void func2() 37 {38 puts (__PRETTY_FUNCTION__);39 }40 void func3() 41 {42 puts (__PRETTY_FUNCTION__);43 }44 };45 46 cc::cc() {}47 cc::~cc() {}48}49 50namespace b {51 class c {52 public:53 c();54 ~c();55 void func1() 56 {57 puts (__PRETTY_FUNCTION__);58 }59 void func3() 60 {61 puts (__PRETTY_FUNCTION__);62 }63 };64 65 c::c() {}66 c::~c() {}67}68 69namespace c {70 class d {71 public:72 d () {}73 ~d() {}74 void func2() 75 {76 puts (__PRETTY_FUNCTION__);77 }78 void func3() 79 {80 puts (__PRETTY_FUNCTION__);81 }82 };83}84 85namespace ns {86template <typename Type> struct Foo {87 template <typename T> void import() {}88 89 template <typename T> auto func() {}90 91 operator bool() { return true; }92 93 template <typename T> operator T() { return {}; }94 95 template <typename T> void operator<<(T t) {}96};97 98template <typename Type> void g() {}99} // namespace ns100 101int main (int argc, char const *argv[])102{103 a::c ac;104 aa::cc aac;105 b::c bc;106 c::d cd;107 ac.func1();108 ac.func2();109 ac.func3();110 aac.func1();111 aac.func2();112 aac.func3();113 bc.func1();114 bc.func3();115 cd.func2();116 cd.func3();117 118 ns::Foo<double> f;119 f.import <int>();120 f.func<int>();121 f.func<ns::Foo<int>>();122 f.operator bool();123 f.operator a::c();124 f.operator ns::Foo<int>();125 f.operator<<(5);126 f.operator<< <ns::Foo<int>>({});127 128 ns::g<int>();129 ns::g<char>();130 131 return 0;132}133