[cfe-dev] Clang::SemaCXX/reinterpret-cast.cpp failing

Ahmed Charles ahmedcharles at gmail.com
Sun Nov 22 00:59:17 PST 2009


> Linux uses LP64. I'd expect this to be an issue only on Windows 64-bit
> builds, where LLP64 is an issue.
>

Just curious, what's LP64/LLP64?


> This should be fixed by using intptr_t.
>

Doesn't seem to work or maybe I did it wrong?

 error: 'error' diagnostics seen but not expected:
  Line 23: use of undeclared identifier 'intptr_t'
  Line 24: use of undeclared identifier 'l'
  Line 25: use of undeclared identifier 'l'
  Line 27: unknown type name 'intptr_t'
16 diagnostics generated.

void integral_conversion()
{
  void *vp = reinterpret_cast<void*>(testval);
  intptr_t l = reinterpret_cast<intptr_t>(vp);
  (void)reinterpret_cast<float*>(l);
  fnptr fnp = reinterpret_cast<fnptr>(l);
  (void)reinterpret_cast<char>(fnp); // expected-error {{cast from pointer
to smaller type 'char' loses information}}
  (void)reinterpret_cast<intptr_t>(fnp);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20091122/4a651e36/attachment.html>


More information about the cfe-dev mailing list