The task of distinguishing the properties of template parameters would also go into the domain of partial class template specialization.

Class template specialization is the tool to change classes depending on the template parameter.


You are asking for a not-so-clean solution, as the triviality depends on the declaration and not the definition of the destructor, which probably is just a bit less problematic for templates.


Nevertheless it would be nicer to handle the conditional outside of the destructor function body.

-----Ursprüngliche Nachricht-----
Von: Frederick Virchanza Gotham via Std-Proposals <>
Gesendet: Di 12.12.2023 13:24

And then add wording to the standard something like:
    "An implementation of a destructor shall be considered trivial if, after expanding an 'if constexpr', the body of the destructor is empty"
And so then an 'aligned<T>' would be trivially destructible if a T is trivially destructible.