C4297 warning in Visual Studio while using function-try-block (function assumed not to throw an exception but does)
问题 #include <exception> struct FOO { ~FOO() try { throw std::exception(); } catch (...) { return; // Shall prevent the exception from being rethrown? } }; Building this code in Visual Studio triggers C4297 warning (function assumed not to throw an exception but does). Reaching the end of a catch clause for a function-try-block on a destructor also automatically rethrows the current exception as if by throw;, but a return statement is allowed . quoted from cppreference.com; Do I interpret this