<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/62436>62436</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Constexpr variable with non-trivial constexpr destructor can generate global/exit-time destructor warnings
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          pkasting
      </td>
    </tr>
</table>

<pre>
    ```
struct S {
  constexpr ~S() {}  // Intentionally not =default so as to be non-trivial
};
constexpr S s;
```
Compiling with `-std=c++20 -Wglobal-constructors -Wexit-time-destructors` triggers both those warnings (see https://godbolt.org/z/9xbKK4Gr1). This seems overly pessimistic; per https://en.cppreference.com/w/cpp/language/constexpr, "If a variable has constant destruction, there is no need to generate machine code in order to call destructor for it, even if its destructor is not trivial.", and indeed there seems to be no generated destructor call here despite the warnings. So I think the warnings are being emitted erroneously.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcU02Po0gM_TXFxQIRQwgcOEw6YtWaY6805wIc8E5RhapMunsP-9tXkI_OtISEZLueP957OgQeLFGt9ke1P0V6kdH5ev6tg7Adotb1n7Uq0tuXnlT6I4hfOoE3UIfjNQLQORuEPmYP_70pLBVWW_ZwAlDYKGzg1QpZYWe1MZ9gnYDKTj2d9WIEggMdQBy0BNbZWDxfWJsrujqcVHbr9NXnDcIj-m3AFzfNbNgO8M4ygirSOEivslOn8KjwiCnEvwbjWm3iDXDdx_kA8S_6YImFJ4p7esRVkYJ4HgbyAVonI8joAsG79pbtEEBhGYhgFJmDyn5cNx5c3zojifODwuZfhU310f78mf_ldwqrBP4eOUAgmgK4C3nzCTOFwBMH4U5lR5jJf4Mkm3Tz7OlMnmxHSecmhc27wqabZ4WN0XZY9EBr4H4ohS-gEF_PoOGiPevWEIw6XCnTVuC-KTu7FstInoADWAeWqF9pGciS10Iw6W5kS9C5noAtON-TXys6bQx83QzOzgPLikcXssBnYAnPBVsDgRvTiUJci7XtgW2_td3muB7orozHIP0z1NZ7q-4pzCy0vn2wk8Cbg1eQke3vPxKgPUFLq05oYllByXtnyS3BfCZRX2d9lVU6onpXlHhIsSgP0Vi32b4qUt2VSF2nqc9wr_PDrir3VdXrXRlxjSlmaY7l7oB5fkiKrMS2Jezyflem57PKU5o0m8SYy7QKJOIQFqoLzLMiMrolEzZHIlp6hy25Hmh_iny9vonbZQgqTw0HCV8owmKofnl45MH35oMnYz359Y872i-mr_5YRXe3xHPp_YbR4k39Tfcs49LetLmOdvvFs3f_UCcKm22hoLDZFv4_AAD__z-Dg4A">