PR4287: allow a variadic prototype to make a subsequent K&R style 
definition variadic.  I'm not completely sure it's legal, but the 
standard can be interpreted as making it legal, and gcc seems to think 
it's legal, so I didn't add an extension warning.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72689 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/knr-variadic-def.c b/test/Sema/knr-variadic-def.c
new file mode 100644
index 0000000..070ba07
--- /dev/null
+++ b/test/Sema/knr-variadic-def.c
@@ -0,0 +1,29 @@
+// RUN: clang-cc -fsyntax-only -verify -pedantic %s
+// PR4287
+
+#include <stdarg.h>
+char *foo = "test";
+int test(char*,...);
+
+int test(fmt)
+        char*fmt;
+{
+        va_list ap;
+        char*a;
+        int x;
+
+        va_start(ap,fmt);
+        a=va_arg(ap,char*);
+        x=(a!=foo);
+        va_end(ap);
+        return x;
+}
+
+void exit();
+
+int main(argc,argv)
+        int argc;char**argv;
+{
+        exit(test("",foo));
+}
+