[libcxx-commits] [PATCH] D147639: [libcxxabi] [test] Don't cast a pointer to long, fixing the test on Windows

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 5 10:03:03 PDT 2023


mstorsjo created this revision.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: libc++abi.
Herald added a reviewer: libc++abi.

Use uintptr_t instead. On Windows, long is 32 bit even on 64 bit
architectures.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147639

Files:
  libcxxabi/test/catch_ptr_02.pass.cpp


Index: libcxxabi/test/catch_ptr_02.pass.cpp
===================================================================
--- libcxxabi/test/catch_ptr_02.pass.cpp
+++ libcxxabi/test/catch_ptr_02.pass.cpp
@@ -17,6 +17,7 @@
 // XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.9
 
 #include <cassert>
+#include <stdint.h>
 
 #if __cplusplus < 201103L
 #define DISABLE_NULLPTR_TESTS
@@ -136,7 +137,7 @@
         assert(false);
     }
     catch (base2 *p) {
-        assert ((unsigned long)p == 12+sizeof(base1));
+        assert ((uintptr_t)p == 12+sizeof(base1));
     }
     catch (...)
     {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147639.511144.patch
Type: text/x-patch
Size: 594 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230405/d2401464/attachment-0001.bin>


More information about the libcxx-commits mailing list