| // The LLVM Compiler Infrastructure |
| // This file is distributed under the University of Illinois Open Source |
| // License. See LICENSE.TXT for details. |
| * Created by Blaine Garst on 2/17/09. |
| // PURPOSE Test that variadic arguments compile and work for Blocks |
| int main(int argc, char *argv[]) { |
| long (^addthem)(const char *, ...) = ^long (const char *format, ...){ |
| //printf("starting...\n"); |
| for (p = format; *p; p++) switch (*p) { |
| d = va_arg(argp, double); |
| //printf("c: '%c'\n", c); |
| long testresult = addthem("ii", 10, 20); |
| printf("got wrong result: %ld\n", testresult); |
| testresult = addthem("idc", 30, 40.0, 'a'); |
| if (testresult != (70+'a')) { |
| printf("got different wrong result: %ld\n", testresult); |
| printf("%s: Success\n", argv[0]); |