< prev index next >

src/hotspot/share/utilities/checkedCast.hpp

Print this page
@@ -24,10 +24,11 @@
  
  #ifndef SHARE_UTILITIES_CHECKEDCAST_HPP
  #define SHARE_UTILITIES_CHECKEDCAST_HPP
  
  #include "utilities/debug.hpp"
+ #include "utilities/globalDefinitions.hpp"
  
  // In many places we've added C-style casts to silence compiler
  // warnings, for example when truncating a size_t to an int when we
  // know the size_t is a small struct. Such casts are risky because
  // they effectively disable useful compiler warnings. We can make our

@@ -36,11 +37,11 @@
  // everything: it isn't intended to make sure that pointer types are
  // compatible, for example.
  template <typename T2, typename T1>
  constexpr T2 checked_cast(T1 thing) {
    T2 result = static_cast<T2>(thing);
-   assert(static_cast<T1>(result) == thing, "must be");
+   assert(static_cast<T1>(result) == thing, "must be, thing: " INTPTR_FORMAT ", result: " INTPTR_FORMAT, (intptr_t)thing, (intptr_t)result);
    return result;
  }
  
  #endif // SHARE_UTILITIES_CHECKEDCAST_HPP
  
< prev index next >