ywkaras commented on a change in pull request #6996:
URL: https://github.com/apache/trafficserver/pull/6996#discussion_r454001638



##########
File path: iocore/eventsystem/I_Continuation.h
##########
@@ -63,6 +63,35 @@ extern EThread *this_event_thread();
 
 typedef int (Continuation::*ContinuationHandler)(int event, void *data);
 
+// Convert event handler pointer fp to type ContinuationHandler, but with a 
compiler error if class C is not
+// derived from the class Continuation.
+//
+template <class C, typename T>
+constexpr ContinuationHandler
+continuation_handler_void_ptr(int (C::*fp)(int, T *))
+{
+  auto fp2 = reinterpret_cast<int (C::*)(int, void *)>(fp);
+  return static_cast<ContinuationHandler>(fp2);
+}
+
+// Overload for nullptr.
+//
+constexpr ContinuationHandler continuation_handler_void_ptr(std::nullptr_t)
+{
+#undef X
+#if !defined(__GNUC__)
+#define X 1
+#else
+#define X (__GNUC__ > 7)

Review comment:
       Note that this does not compile:  https://godbolt.org/z/erGjoj
   
   I'm not sure the Standard guarantees that a compiler won't warn that 
__GNUC__ is not defined when it compared to 7.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to