< prev index next >

src/share/vm/utilities/debug.hpp

Print this page
rev 7563 : 8067306: Improve STATIC_ASSERT
Summary: New improved implementation
Reviewed by:
rev 7564 : [mq]: update1

@@ -231,19 +231,20 @@
 //
 // Implementation Note: STATIC_ASSERT_FAILURE<true> provides a value member
 // rather than type member that could be used directly in the typedef, because
 // a type member would require conditional use of "typename", depending on
 // whether Cond is dependent or not.  The use of a value member leads to the
-// use of an array type.
+// use of an array type.  Terniary operator because, purportedly, some old
+// compilers don't handle implicit conversion properly in this context.  It
+// also deals with C++11 constexpr explicit conversion to bool :)
 
 template<bool x> struct STATIC_ASSERT_FAILURE;
 template<> struct STATIC_ASSERT_FAILURE<true> { enum { value = 1 }; };
 
 #define STATIC_ASSERT(Cond) \
   typedef char STATIC_ASSERT_FAILURE_ ## __LINE__ [ \
-    STATIC_ASSERT_FAILURE< (Cond) ? true : false >::value ] \
-  /* */
+    STATIC_ASSERT_FAILURE< (Cond) ? true : false >::value ]
 
 // out of shared space reporting
 enum SharedSpaceType {
   SharedReadOnly,
   SharedReadWrite,
< prev index next >