[clang] [clang] [test] Fix a new test on mingw (PR #212064)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 25 13:47:58 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Martin Storsjö (mstorsjo)

<details>
<summary>Changes</summary>

This fixes running a new test that was added in
4b66bacd1fdf02803509b744034f3ab09945157c, in mingw environments.

The quirks that warranted adding the `!defined(_WIN32)` condition in the test aren't actually specific to Windows in general, but specific to MSVC environments - mingw environments behave just like other platforms.

Ideally we'd use `!defined(_MSC_VER)`, however in -cc1 mode, Clang doesn't automatically define `_MSC_VER`; defining it requires setting a command line option that the driver normally passes in MSVC mode. Therefore, qualify the condition as `!defined(_MSC_VER) || defined(__MINGW32__)`.

---
Full diff: https://github.com/llvm/llvm-project/pull/212064.diff


1 Files Affected:

- (modified) clang/test/AST/ByteCode/virtual-bases.cpp (+1-1) 


``````````diff
diff --git a/clang/test/AST/ByteCode/virtual-bases.cpp b/clang/test/AST/ByteCode/virtual-bases.cpp
index 1543249ec69fe..a7233f2df9c17 100644
--- a/clang/test/AST/ByteCode/virtual-bases.cpp
+++ b/clang/test/AST/ByteCode/virtual-bases.cpp
@@ -437,7 +437,7 @@ namespace Offsets {
   };
 
   constexpr C c{12};
-#if !defined(_WIN32)
+#if !defined(_WIN32) || defined(__MINGW32__)
 #if __SIZEOF_SIZE_T__ == 8
   static_assert( (fold((char*)&c.c - (char*)&c)) == 12);
   static_assert( (fold((char*)&c.b - (char*)&c)) == 8);

``````````

</details>


https://github.com/llvm/llvm-project/pull/212064


More information about the cfe-commits mailing list