Mac compiling errors - object backing the pointer ... will be destroyed at the end of the full-expression [-Werror,-Wdangling-assignment]

yes, please reference here