Index: lib/Sema/SemaExpr.cpp =================================================================== --- lib/Sema/SemaExpr.cpp +++ lib/Sema/SemaExpr.cpp @@ -875,7 +875,8 @@ // Diagnostics regarding non-POD argument types are // emitted along with format string checking in Sema::CheckFunctionCall(). - if (isValidVarArgType(E->getType()) == VAK_Undefined) { + if (isValidVarArgType(E->getType()) == VAK_Undefined && + !LangOpts.MSVCCompat) { // Turn this into a trap. CXXScopeSpec SS; SourceLocation TemplateKWLoc; Index: test/CodeGenCXX/vararg-non-pod-ms-compat.cpp =================================================================== --- /dev/null +++ test/CodeGenCXX/vararg-non-pod-ms-compat.cpp @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -Wno-error=non-pod-varargs -triple i686-pc-win32 -fms-compatibility -emit-llvm -o - %s | FileCheck %s + +struct X { + X(); + ~X(); + int data; +}; + +void vararg(...); + +// CHECK-LABEL: define void @"\01?test@@YAXUX@@@Z" +void test(X x) { + // CHECK: %[[argmem:[^ ]*]] = alloca inalloca <{ %struct.X }> + // CHECK: call void (<{ %struct.X }>*, ...)* bitcast (void (...)* @"\01?vararg@@YAXZZ" to void (<{ %struct.X }>*, ...)*)(<{ %struct.X }>* inalloca %[[argmem]]) + // CHECK-NOT: llvm.trap + vararg(x); + // CHECK: ret void +} + Index: test/SemaCXX/vararg-non-pod.cpp =================================================================== --- test/SemaCXX/vararg-non-pod.cpp +++ test/SemaCXX/vararg-non-pod.cpp @@ -1,5 +1,8 @@ // RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s -Wno-error=non-pod-varargs +// Check that the warning is still there under -fms-compatibility. +// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s -Wno-error=non-pod-varargs -fms-compatibility + extern char version[]; class C {