[cfe-commits] r89583 - /cfe/trunk/test/SemaCXX/reinterpret-cast.cpp
Sean Hunt
rideau3 at gmail.com
Sat Nov 21 23:05:51 PST 2009
Author: coppro
Date: Sun Nov 22 01:05:50 2009
New Revision: 89583
URL: http://llvm.org/viewvc/llvm-project?rev=89583&view=rev
Log:
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.
Modified:
cfe/trunk/test/SemaCXX/reinterpret-cast.cpp
Modified: cfe/trunk/test/SemaCXX/reinterpret-cast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/reinterpret-cast.cpp?rev=89583&r1=89582&r2=89583&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/reinterpret-cast.cpp (original)
+++ cfe/trunk/test/SemaCXX/reinterpret-cast.cpp Sun Nov 22 01:05:50 2009
@@ -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 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()
More information about the cfe-commits
mailing list