title: Why is address of non-static member not allowed as template non-type parameter?
body: <pre><code>template &lt;int* ip&gt; struct test {};
  
  struct q {
      static int a;
      int b;
      
      constexpr q(int b_) : b(b_) {}
  };
  
  int i;
  constexpr q q0(2);
  
  int main()
  {
      constexpr test&lt;&amp;i&gt; t1;      // Works fine
      constexpr test&lt;&amp;q::a&gt; t2;   // Works 
      constexpr test&lt;&amp;q0.b&gt; t3;   // Does not work; address of non-static member?
      
      return 0;
  }
  </code></pre>
  <p>The declaration of t3 in the above piece of code fails despite the template argument <code>&amp;q0.b</code> being known during compile time. Some googling revealed that this is disallowed by the standard (section 14.3.2):</p>
  <blockquote>
  <p>[Note: Addresses of array elements and names or addresses of non-static class members are not acceptable template-arguments.</p>
  <p>X&lt;&amp;s.m&gt; x4; // error: address of non-static membe</p>
  </blockquote>
  <p>So why exactly is this explicitly disallowed by the standard despite the addresses of non-static members of global variables being unique as well as known during compile-time?</p>