title: Is there a way to use concepts to disable member functions that would produce a reference to void?
body: <p>I would expect it to be possible to write a class like this</p>
  <pre class="lang-cpp prettyprint-override"><code>template &lt;class T&gt;
  struct A {
      T&amp; operator*() 
          requires (!std::is_void_v&lt;T&gt;)
      {
          return *ptr;
      }
      T* ptr;
  };
  </code></pre>
  <p>But if I write</p>
  <pre class="lang-cpp prettyprint-override"><code>A&lt;void&gt; a;
  </code></pre>
  <p>I get the compiler error</p>
  <pre><code>prog.cc: In instantiation of 'struct A&lt;void&gt;':
  prog.cc:16:13:   required from here
  prog.cc:5:8: error: forming reference to void
      5 |     T&amp; operator*()
        |        ^~~~~~~~
  
  </code></pre>
  <p>even though the requires clause disables that function.</p>
  <p>Is there any way to write the class so that the disabled method is acceptable by the compiler?</p>
  <p>(I'm aware I could partially specialize A for void but that's less convenient).</p>