Looking for an answer for C# and C++. (in C#, replace 'destructor' with 'finalizer')
It does for C# (see code below) but not for C++.
using System;
class Test
{
Test()
{
throw new Exception();
}
~Test()
{
Console.WriteLine("Finalized");
}
static void Main()
{
try
{
new Test();
}
catch {}
GC.Collect();
GC.WaitForPendingFinalizers();
}
}
This prints "Finalized"