Fix PR5329: pay attention to constructor/destructor priority