title: reinterpret_cast to function pointer
body: <p>There is the code that I've written for experiments with <code>reinterpret_cast&lt;T&gt;</code></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  
  using std::cout;
  using std::endl;
  
  int foo()
  {
      cout &lt;&lt; "foo" &lt;&lt; endl;
      return 0;
  }
  
  void (*bar)();
  int main()
  {
  
      bar = reinterpret_cast&lt;void (*)()&gt;(foo); //Convertion a function type to a pointer to function type
      bar(); //displays foo. Is it UB?
  }
  </code></pre>
  
  <p>First of all why such <code>reinterpret_cast</code> convertion permitted? I thought such conversion is ill-formed.</p>