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

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 12 00:18:39 PDT 2023


Author: Martin Storsjö
Date: 2023-04-12T10:17:21+03:00
New Revision: 9c8264f1600bffe00589879ced61042363b5ba13

URL: https://github.com/llvm/llvm-project/commit/9c8264f1600bffe00589879ced61042363b5ba13
DIFF: https://github.com/llvm/llvm-project/commit/9c8264f1600bffe00589879ced61042363b5ba13.diff

LOG: [libcxxabi] [test] Don't cast a pointer to long, fixing the test on Windows

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

Differential Revision: https://reviews.llvm.org/D147639

Added: 
    

Modified: 
    libcxxabi/test/catch_ptr_02.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxxabi/test/catch_ptr_02.pass.cpp b/libcxxabi/test/catch_ptr_02.pass.cpp
index 4683f818b39e2..c7ef28a976f88 100644
--- a/libcxxabi/test/catch_ptr_02.pass.cpp
+++ b/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 @@ void test7 ()
         assert(false);
     }
     catch (base2 *p) {
-        assert ((unsigned long)p == 12+sizeof(base1));
+        assert ((uintptr_t)p == 12+sizeof(base1));
     }
     catch (...)
     {


        


More information about the libcxx-commits mailing list