diff options
author | Alexis Hunt <alercah@gmail.com> | 2009-11-22 07:05:50 +0000 |
---|---|---|
committer | Alexis Hunt <alercah@gmail.com> | 2009-11-22 07:05:50 +0000 |
commit | 12048d868b51701295c95f23c47c9b3e8b6cf6c8 (patch) | |
tree | d7fbdc1cd9101b8644b41638d40d4dd4864c45cb /clang | |
parent | 7248f86432efec7c9e36d228f8b680a1f8eeccff (diff) | |
download | bcm5719-llvm-12048d868b51701295c95f23c47c9b3e8b6cf6c8.tar.gz bcm5719-llvm-12048d868b51701295c95f23c47c9b3e8b6cf6c8.zip |
Use intptr_t rather than long so that this test will not fail on LLP64 systems,
where long is only 32-bits and so a reinterpret_cast would be ill-formed.
llvm-svn: 89583
Diffstat (limited to 'clang')
-rw-r--r-- | clang/test/SemaCXX/reinterpret-cast.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/test/SemaCXX/reinterpret-cast.cpp b/clang/test/SemaCXX/reinterpret-cast.cpp index be960a3af8b..bfe8887bd3d 100644 --- a/clang/test/SemaCXX/reinterpret-cast.cpp +++ b/clang/test/SemaCXX/reinterpret-cast.cpp @@ -1,5 +1,7 @@ // RUN: clang-cc -fsyntax-only -verify %s +#include <stdint.h> + enum test { testval = 1 }; struct structure { int m; }; typedef void (*fnptr)(); @@ -20,11 +22,11 @@ void self_conversion() void integral_conversion() { void *vp = reinterpret_cast<void*>(testval); - long l = reinterpret_cast<long>(vp); - (void)reinterpret_cast<float*>(l); - fnptr fnp = reinterpret_cast<fnptr>(l); + intptr_t i = reinterpret_cast<intptr_t>(vp); + (void)reinterpret_cast<float*>(i); + fnptr fnp = reinterpret_cast<fnptr>(i); (void)reinterpret_cast<char>(fnp); // expected-error {{cast from pointer to smaller type 'char' loses information}} - (void)reinterpret_cast<long>(fnp); + (void)reinterpret_cast<intptr_t>(fnp); } void pointer_conversion() |