diff options
Diffstat (limited to 'test/Sema/varargs.c')
-rw-r--r-- | test/Sema/varargs.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/Sema/varargs.c b/test/Sema/varargs.c index 457d84c212f7..25a5c72c42e3 100644 --- a/test/Sema/varargs.c +++ b/test/Sema/varargs.c @@ -1,5 +1,6 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s -triple i386-pc-unknown // RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-apple-darwin9 +// RUN: %clang_cc1 -fsyntax-only -fms-compatibility -DMS -verify %s -triple x86_64-pc-win32 void f1(int a) { @@ -94,3 +95,20 @@ void f12(register int i, ...) { // expected-note {{parameter of type 'int' is d __builtin_va_start(ap, i); // expected-warning {{passing a parameter declared with the 'register' keyword to 'va_start' has undefined behavior}} __builtin_va_end(ap); } + +enum __attribute__((packed)) E1 { + one1 +}; + +void f13(enum E1 e, ...) { + __builtin_va_list va; + __builtin_va_start(va, e); +#ifndef MS + // In Microsoft compatibility mode, all enum types are int, but in + // non-ms-compatibility mode, this enumeration type will undergo default + // argument promotions. + // expected-note@-7 {{parameter of type 'enum E1' is declared here}} + // expected-warning@-6 {{passing an object that undergoes default argument promotion to 'va_start' has undefined behavior}} +#endif + __builtin_va_end(va); +} |