xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/knr-variadic-def.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
2*f4a2713aSLionel Sambuc // expected-no-diagnostics
3*f4a2713aSLionel Sambuc // PR4287
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc #include <stdarg.h>
6*f4a2713aSLionel Sambuc char *foo = "test";
7*f4a2713aSLionel Sambuc int test(char*,...);
8*f4a2713aSLionel Sambuc 
test(fmt)9*f4a2713aSLionel Sambuc int test(fmt)
10*f4a2713aSLionel Sambuc         char*fmt;
11*f4a2713aSLionel Sambuc {
12*f4a2713aSLionel Sambuc         va_list ap;
13*f4a2713aSLionel Sambuc         char*a;
14*f4a2713aSLionel Sambuc         int x;
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc         va_start(ap,fmt);
17*f4a2713aSLionel Sambuc         a=va_arg(ap,char*);
18*f4a2713aSLionel Sambuc         x=(a!=foo);
19*f4a2713aSLionel Sambuc         va_end(ap);
20*f4a2713aSLionel Sambuc         return x;
21*f4a2713aSLionel Sambuc }
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc void exit();
24*f4a2713aSLionel Sambuc 
main(argc,argv)25*f4a2713aSLionel Sambuc int main(argc,argv)
26*f4a2713aSLionel Sambuc         int argc;char**argv;
27*f4a2713aSLionel Sambuc {
28*f4a2713aSLionel Sambuc         exit(test("",foo));
29*f4a2713aSLionel Sambuc }
30*f4a2713aSLionel Sambuc 
31