title: Object of pointer type 'gpointer' cast to unrelated type 'string*'
body: <p>I'm trying to make some code MISRA complaint and I have the following piece of code:</p>
  
  <pre><code>static void DBusCallback(GObject *object, GAsyncResult *res, gpointer user_data) {
      std::string * const tmp = reinterpret_cast&lt;std::string*&gt;(user_data);
      ...
  </code></pre>
  
  <p>where DBusCallback is a callback for call_DBus:</p>
  
  <pre><code>   (void)call_DBus(proxy, NULL, &amp;DBusCallback, reinterpret_cast&lt;void*&gt;(new std::string(user_data)));
  </code></pre>
  
  <p>//last pram is the user_data from the callback</p>
  
  <p>It compiles and runs ok, but I have the following MISRA warning at string conversion from gpointer:
  MISRA.CAST.PTR.UNRELATED : Object of pointer type 'gpointer' cast to unrelated type 'string*'</p>
  
  <p>The rule is:
  MISRA-C++ Rule 5-2-7 (required): An object with pointer type shall not be converted to an unrelated pointer type, either directly or indirectly.
  [Unspecified 5.2.10(7)]
  Rationale
  The result of converting from a pointer to an unrelated type is unspecified.</p>
  
  <p>Any idea to avoid this warning?</p>