| 1 |
// RUN: %clang_cc1 -triple thumbv7-windows -fms-compatibility -fsyntax-only %s -verify |
| 2 |
|
| 3 |
extern "C" { |
| 4 |
typedef char * va_list; |
| 5 |
} |
| 6 |
|
| 7 |
void test_no_arguments(int i, ...) { |
| 8 |
__va_start(); // expected-error{{too few arguments to function call, expected at least 3, have 0}} |
| 9 |
} |
| 10 |
|
| 11 |
void test_one_argument(int i, ...) { |
| 12 |
va_list ap; |
| 13 |
__va_start(&ap); // expected-error{{too few arguments to function call, expected at least 3, have 1}} |
| 14 |
} |
| 15 |
|
| 16 |
void test_two_arguments(int i, ...) { |
| 17 |
va_list ap; |
| 18 |
__va_start(&ap, &i); // expected-error{{too few arguments to function call, expected at least 3, have 2}} |
| 19 |
} |
| 20 |
|
| 21 |
void test_non_last_argument(int i, int j, ...) { |
| 22 |
va_list ap; |
| 23 |
__va_start(&ap, &i, 4); |
| 24 |
// expected-error@-1{{passing 'int *' to parameter of incompatible type 'const char *': type mismatch at 2nd parameter ('int *' vs 'const char *')}} |
| 25 |
// expected-error@-2{{passing 'int' to parameter of incompatible type '__size_t' (aka 'unsigned int'): type mismatch at 3rd parameter ('int' vs '__size_t' (aka 'unsigned int'))}} |
| 26 |
} |
| 27 |
|
| 28 |
void test_stack_allocated(int i, ...) { |
| 29 |
va_list ap; |
| 30 |
int j; |
| 31 |
__va_start(&ap, &j, 4); |
| 32 |
// expected-error@-1{{passing 'int *' to parameter of incompatible type 'const char *': type mismatch at 2nd parameter ('int *' vs 'const char *')}} |
| 33 |
// expected-error@-2{{passing 'int' to parameter of incompatible type '__size_t' (aka 'unsigned int'): type mismatch at 3rd parameter ('int' vs '__size_t' (aka 'unsigned int'))}} |
| 34 |
} |
| 35 |
|
| 36 |
void test_non_pointer_addressof(int i, ...) { |
| 37 |
va_list ap; |
| 38 |
__va_start(&ap, 1, 4); |
| 39 |
// expected-error@-1{{passing 'int' to parameter of incompatible type 'const char *': type mismatch at 2nd parameter ('int' vs 'const char *')}} |
| 40 |
// expected-error@-2{{passing 'int' to parameter of incompatible type '__size_t' (aka 'unsigned int'): type mismatch at 3rd parameter ('int' vs '__size_t' (aka 'unsigned int'))}} |
| 41 |
} |
| 42 |
|