title: constexpr C++ error: destructor used before its definition
body: <p>I'm experiencing an error using g++-12 which does not occur in clang++-13.  In particular, this code:</p>
  <pre><code>struct A {
      constexpr virtual ~A() = default;
      constexpr A() = default;
  };
  
  struct B : public A {
      constexpr ~B() = default;
      constexpr B() = default;
  };
  
  constexpr int demo(){
      B *b = new B();
      delete b;
      return 2;
  }
  
  int main(){
      constexpr int demod = demo();
      return demod;
  }
  </code></pre>
  <p>Compiles with clang++, but with g++ gives the error:</p>
  <pre class="lang-text prettyprint-override"><code>minimize-error.cpp: In function ‘int main()’:
  minimize-error.cpp:18:31:   in ‘constexpr’ expansion of ‘demo()’
  minimize-error.cpp:13:12: error: ‘virtual constexpr B::~B()’ used before its definition
     13 |     delete b;
        |
  </code></pre>
  <p>Curiously, if I just remove the <code>constexpr</code> requirement on <code>demod</code>, the example compiles and runs without error.</p>
  <p>Any ideas as to what's happening here?</p>