[clang] [clang] [test] Fix a new test on mingw (PR #212064)
Martin Storsjö via cfe-commits
cfe-commits at lists.llvm.org
Sat Jul 25 13:47:23 PDT 2026
https://github.com/mstorsjo created https://github.com/llvm/llvm-project/pull/212064
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__)`.
>From 921fa03e0e308126505a23c3149aaf6ba3bb05cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
Date: Sat, 25 Jul 2026 20:39:49 +0000
Subject: [PATCH] [clang] [test] Fix a new test on mingw
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__)`.
---
clang/test/AST/ByteCode/virtual-bases.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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);
More information about the cfe-commits
mailing list