You cannot get a pointer to a destructor function or constructor. However, a destructor always exists for a type, and you cannot detect if it is private
, since access specifiers are not considered by SFINAE.
On the issue of invoking what will be a scalar type destructor, the standard says [class.dtor] / 16:
[Note: the designation for explicitly calling the destructor can be used for any scalar type name (5.2.4). This allows you to write code without knowing if a destructor exists for this type. For instance,
typedef int I;
I * p;
p> I :: ~ I ();
-end note]
source share