diff options
author | Sean Hunt <rideau3@gmail.com> | 2009-11-22 07:05:50 +0000 |
---|---|---|
committer | Sean Hunt <rideau3@gmail.com> | 2009-11-22 07:05:50 +0000 |
commit | f1cd5e5c85f2ad433874310d826c1860a262909c (patch) | |
tree | c0082e08657be65df11787a09894279b98856a1a | |
parent | b681b61fea36618778b8030360e90e3f4641233b (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89583 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/SemaCXX/reinterpret-cast.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/SemaCXX/reinterpret-cast.cpp b/test/SemaCXX/reinterpret-cast.cpp index be960a3af8..bfe8887bd3 100644 --- a/test/SemaCXX/reinterpret-cast.cpp +++ b/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() |