Fix up support for ASIO_NO_TYPEID (i.e. no RTTI).
diff --git a/asio/include/asio/executor.hpp b/asio/include/asio/executor.hpp
index a3b5730..66886da 100644
--- a/asio/include/asio/executor.hpp
+++ b/asio/include/asio/executor.hpp
@@ -205,10 +205,17 @@
    * @returns If @c *this has a target type of type @c T, <tt>typeid(T)</tt>;
    * otherwise, <tt>typeid(void)</tt>.
    */
+#if !defined(ASIO_NO_TYPEID) || defined(GENERATING_DOCUMENTATION)
   const std::type_info& target_type() const ASIO_NOEXCEPT
   {
     return impl_ ? impl_->target_type() : typeid(void);
   }
+#else // !defined(ASIO_NO_TYPEID) || defined(GENERATING_DOCUMENTATION)
+  const void* target_type() const ASIO_NOEXCEPT
+  {
+    return impl_ ? impl_->target_type() : 0;
+  }
+#endif // !defined(ASIO_NO_TYPEID) || defined(GENERATING_DOCUMENTATION)
 
   /// Obtain a pointer to the target executor object.
   /**
@@ -249,6 +256,23 @@
   class function;
   template <typename, typename> class impl;
 
+#if !defined(ASIO_NO_TYPEID)
+  typedef const std::type_info& type_id_result_type;
+#else // !defined(ASIO_NO_TYPEID)
+  typedef const void* type_id_result_type;
+#endif // !defined(ASIO_NO_TYPEID)
+
+  template <typename T>
+  static type_id_result_type type_id()
+  {
+#if !defined(ASIO_NO_TYPEID)
+    return typeid(T);
+#else // !defined(ASIO_NO_TYPEID)
+    static int unique_id;
+    return &unique_id;
+#endif // !defined(ASIO_NO_TYPEID)
+  }
+
   // Base class for all polymorphic executor implementations.
   class impl_base
   {
@@ -261,7 +285,7 @@
     virtual void dispatch(ASIO_MOVE_ARG(function)) = 0;
     virtual void post(ASIO_MOVE_ARG(function)) = 0;
     virtual void defer(ASIO_MOVE_ARG(function)) = 0;
-    virtual const std::type_info& target_type() const ASIO_NOEXCEPT = 0;
+    virtual type_id_result_type target_type() const ASIO_NOEXCEPT = 0;
     virtual void* target() ASIO_NOEXCEPT = 0;
     virtual const void* target() const ASIO_NOEXCEPT = 0;
     virtual bool equals(const impl_base* e) const ASIO_NOEXCEPT = 0;
diff --git a/asio/include/asio/impl/executor.hpp b/asio/include/asio/impl/executor.hpp
index d8bc403..38bcb45 100644
--- a/asio/include/asio/impl/executor.hpp
+++ b/asio/include/asio/impl/executor.hpp
@@ -197,9 +197,9 @@
     executor_.defer(ASIO_MOVE_CAST(function)(f), allocator_);
   }
 
-  const std::type_info& target_type() const ASIO_NOEXCEPT
+  type_id_result_type target_type() const ASIO_NOEXCEPT
   {
-    return typeid(Executor);
+    return type_id<Executor>();
   }
 
   void* target() ASIO_NOEXCEPT
@@ -306,9 +306,9 @@
     executor_.defer(ASIO_MOVE_CAST(function)(f), allocator_);
   }
 
-  const std::type_info& target_type() const ASIO_NOEXCEPT
+  type_id_result_type target_type() const ASIO_NOEXCEPT
   {
-    return typeid(system_executor);
+    return type_id<system_executor>();
   }
 
   void* target() ASIO_NOEXCEPT
@@ -368,14 +368,14 @@
 template <typename Executor>
 Executor* executor::target() ASIO_NOEXCEPT
 {
-  return impl_ && impl_->target_type() == typeid(Executor)
+  return impl_ && impl_->target_type() == type_id<Executor>()
     ? static_cast<Executor*>(impl_->target()) : 0;
 }
 
 template <typename Executor>
 const Executor* executor::target() const ASIO_NOEXCEPT
 {
-  return impl_ && impl_->target_type() == typeid(Executor)
+  return impl_ && impl_->target_type() == type_id<Executor>()
     ? static_cast<Executor*>(impl_->target()) : 0;
 }