title: std::launder use cases in C++20
body: <p><strong>[1]</strong></p>
  
  <p>Are there any cases in which the addition of <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p0593r6.html" rel="noreferrer">p0593r6</a> into C++20 (<em>§ 6.7.2.11</em> Object model <a href="http://eel.is/c++draft/intro.object" rel="noreferrer">[intro.object]</a>) made <code>std::launder</code> not necessary, where the same use case in C++17 required <code>std::launder</code>, or are they <em>completely orthogonal</em>?</p>
  
  <hr>
  
  <p><strong>[2]</strong></p>
  
  <p>The example in the spec for <a href="http://eel.is/c++draft/ptr.launder#6" rel="noreferrer">[ptr::launder]</a> is:</p>
  
  <pre><code>struct X { int n; };
  const X *p = new const X{3};
  const int a = p-&gt;n;
  new (const_cast&lt;X*&gt;(p)) const X{5}; // p does not point to new object ([basic.life]) because its type is const
  const int b = p-&gt;n;                 // undefined behavior
  const int c = std::launder(p)-&gt;n;   // OK
  </code></pre>
  
  <p>Another example is given by @Nicol Bolas <a href="https://stackoverflow.com/a/39382728/2085626">in this SO answer</a>, using a pointer that points to a valid storage but of a different type:</p>
  
  <pre><code>aligned_storage&lt;sizeof(int), alignof(int)&gt;::type data;
  new(&amp;data) int;
  int *p = std::launder(reinterpret_cast&lt;int*&gt;(&amp;data));
  </code></pre>
  
  <p>Are there other use cases, not related to allowing casting of two objects which are not <a href="http://eel.is/c++draft/basic.life#def:transparently_replaceable" rel="noreferrer"><em>transparently replaceable</em></a>, for using <code>std::launder</code>?</p>
  
  <p>Specifically:</p>
  
  <ul>
  <li>Would <em>reinterpret_cast</em> from A* to B*, both are <a href="http://eel.is/c++draft/basic.compound#def:pointer-interconvertible" rel="noreferrer"><em>pointer-interconvertible</em></a>, may require using <code>std::launder</code> in any case? (i.e. can two pointers be <em>pointer-interconvertible</em> and yet not be <em>transparently replaceable</em>? the spec didn't relate between these two terms).</li>
  <li>Does <em>reinterpret_cast</em> from <a href="http://eel.is/c++draft/basic.compound#5" rel="noreferrer">void*</a> to T* require using <code>std::launder</code>?</li>
  <li>Does the following code below require use of <code>std::launder</code>? If so, under which case in the spec does it fall to require that?</li>
  </ul>
  
  <p>A struct with reference member, inspired by <a href="https://groups.google.com/a/isocpp.org/forum/#!msg/std-proposals/93ebFsxCjvQ/myxPG6o_9pkJ" rel="noreferrer">this discussion</a>:</p>
  
  <pre><code>struct A {
      constexpr A(int &amp;x) : ref(x) {}
      int &amp;ref;
  };
  
  int main() {
      int n1 = 1, n2 = 2;
      A a { n1 };
      a.~A();
      new (&amp;a) A {n2};
      a.ref = 3; // do we need to launder somebody here?
      std::cout &lt;&lt; a.ref &lt;&lt; ' ' &lt;&lt; n1 &lt;&lt; ' ' &lt;&lt; n2 &lt;&lt; std::endl;
  }
  </code></pre>