title: Pointer to member function, always prints as "1"
body: <p>I was trying a new approach to the answer I gave to <a href="https://stackoverflow.com/questions/56292104/hashing-types-at-compile-time-in-c17-c2a">this question</a>, I thought that returning the address of a member function as ID could be a path worth to explore:</p>
  
  <pre><code>struct S
  {
      template &lt;typename T&gt;
      void f(){};
  
      using mp = void(S::*)();
  
      template &lt;typename T&gt;
      static constexpr mp ID()
      {
          return &amp;S::f&lt;T&gt;;
      }
  };
  </code></pre>
  
  <p>I thought that every instantiation of <code>S::f</code> would have an unique address which will be shared in every translation unit and even might be available at compile time, so I tested it:</p>
  
  <pre><code>std::cout &lt;&lt; S::ID&lt;char&gt;() &lt;&lt; '\n';
  </code></pre>
  
  <p>And the output was <code>1</code>; quite unexpected to be honest (I was expecting the value to be printed as an hex number, like other pointers), but moving forward I tried other types:</p>
  
  <pre><code>std::cout &lt;&lt; S::ID&lt;char&gt;() &lt;&lt; '\n';  // Prints '1'.
  std::cout &lt;&lt; S::ID&lt;char&gt;() &lt;&lt; '\n';  // Expecting '1', got '1'.
  std::cout &lt;&lt; S::ID&lt;short&gt;() &lt;&lt; '\n'; // Execting something different to '1', got '1'.
  </code></pre>
  
  <p>At this point, I realized that the <code>1</code> value wasn't the "<em>adress of the member function inside the object</em>" because two different functions (<code>void S::f&lt;char&gt;()</code> and <code>void S::f&lt;short&gt;()</code>) shared the same <em>address</em>. So I've tried another approach:</p>
  
  <pre><code>struct S
  {
      template &lt;typename T&gt;
      static auto ID()
      {
          return +[]{};
      }
  };
  </code></pre>
  
  <p>Captureless lambdas can be converted to function pointers and each lambda has an unique type even if its contents are the same, so I was expecting some random-<em>ish</em> values but got <code>1</code> again:</p>
  
  <pre><code>std::cout &lt;&lt; S::ID&lt;char&gt;() &lt;&lt; '\n';  // Expecting '0x????????' Prints '1'.
  std::cout &lt;&lt; S::ID&lt;char&gt;() &lt;&lt; '\n';  // Expecting '0x????????' Prints '1'.
  std::cout &lt;&lt; S::ID&lt;short&gt;() &lt;&lt; '\n'; // Expecting '0x!!!!!!!!' Prints '1'.
  </code></pre>
  
  <hr>
  
  <p>At this point, I just want to know what those <code>1</code> means and why are all of them <code>1</code> even if the <em>expected</em> behaviour is that all of them must yield a different value.</p>