Aaron Smith | 7ac1c78 | 2018-02-09 05:31:28 +0000 | [diff] [blame] | 1 | |
| 2 | // Global functions |
| 3 | int Func_arg_array(int array[]) { return 1; } |
| 4 | void Func_arg_void(void) { return; } |
| 5 | void Func_arg_none(void) { return; } |
| 6 | void Func_varargs(...) { return; } |
| 7 | |
| 8 | // Class |
| 9 | namespace MemberTest { |
| 10 | class A { |
| 11 | public: |
| 12 | int Func(int a, ...) { return 1; } |
| 13 | }; |
| 14 | } |
| 15 | |
| 16 | // Template |
| 17 | template <int N=1, class ...T> |
| 18 | void TemplateFunc(T ...Arg) { |
| 19 | return; |
| 20 | } |
| 21 | |
| 22 | // namespace |
| 23 | namespace { |
| 24 | void Func(int a, const long b, volatile bool c, ...) { return; } |
| 25 | } |
| 26 | |
| 27 | namespace NS { |
| 28 | void Func(char a, int b) { |
| 29 | return; |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | // Static function |
| 34 | static long StaticFunction(int a) |
| 35 | { |
| 36 | return 2; |
| 37 | } |
| 38 | |
| 39 | // Inlined function |
| 40 | inline void InlinedFunction(long a) { return; } |
| 41 | |
| 42 | extern void FunctionCall(); |
| 43 | |
| 44 | int main() { |
| 45 | MemberTest::A v1; |
| 46 | v1.Func('a',10); |
| 47 | |
| 48 | Func(1, 5, true, 10, 8); |
| 49 | NS::Func('c', 2); |
| 50 | |
| 51 | TemplateFunc(10); |
| 52 | TemplateFunc(10,11,88); |
| 53 | |
| 54 | StaticFunction(2); |
| 55 | InlinedFunction(1); |
| 56 | |
| 57 | FunctionCall(); |
| 58 | return 0; |
| 59 | } |