Daniel Dunbar | 9562726 | 2008-08-21 04:30:23 +0000 | [diff] [blame] | 1 | // RUN: clang -emit-llvm %s -o %t |
Chris Lattner | 0442108 | 2008-04-08 04:40:51 +0000 | [diff] [blame] | 2 | |
| 3 | // Note: define CLANG_GENERATE_KNOWN_GOOD and compile to generate code |
| 4 | // that makes all of the defaulted arguments explicit. The resulting |
| 5 | // byte code should be identical to the compilation without |
| 6 | // CLANG_GENERATE_KNOWN_GOOD. |
| 7 | #ifdef CLANG_GENERATE_KNOWN_GOOD |
| 8 | # define DEFARG(...) __VA_ARGS__ |
| 9 | #else |
| 10 | # define DEFARG(...) |
| 11 | #endif |
| 12 | |
| 13 | extern int x; |
| 14 | struct S { float x; float y; } s; |
| 15 | double _Complex c; |
| 16 | |
| 17 | void f(int i = 0, int j = 1, int k = x, struct S t = s, double _Complex d = c); |
| 18 | |
| 19 | void g() { |
| 20 | f(0, 1, x, s DEFARG(, c)); |
| 21 | f(0, 1, x DEFARG(, s, c)); |
| 22 | f(0, 1 DEFARG(, x, s, c)); |
| 23 | f(0 DEFARG(, 1, x, s, c)); |
| 24 | f(DEFARG(0, 1, x, s, c)); |
| 25 | } |