[PATCH] Don't trap when passing non-POD arguments to variadic functions in MS-compatibility mode

Reid Kleckner rnk at google.com
Thu Sep 25 11:19:32 PDT 2014


Works for me if Richard is OK with it.

It's also worth noting that we already do exactly what MSVC does, which is a bitwise copy of the argument. The callee does *not* destroy the copy, so the program behaves "correctly" despite the UB. We don't need to go further out of our way to make it work.

================
Comment at: test/CodeGenCXX/vararg-non-pod-ms-compat.cpp:1
@@ +1,2 @@
+// RUN: %clang_cc1 -Wno-error=non-pod-varargs -triple i686-pc-win32 -fms-compatibility -emit-llvm -o - %s | FileCheck %s
+
----------------
Can you add a win64 test case?  IIRC we coerce to i64 there, which is compatible with what MSVC does.

http://reviews.llvm.org/D5492






More information about the cfe-commits mailing list