提交 56ec171f 编写于 作者: A Alexey Milovidov

Better check

上级 608d8e85
......@@ -23,11 +23,22 @@ namespace
struct AggregateFunctionThrowData
{
std::unique_ptr<char> memory{ new char };
bool allocated;
AggregateFunctionThrowData() : allocated(true) {}
~AggregateFunctionThrowData()
{
volatile bool * allocated_ptr = &allocated;
if (*allocated_ptr)
*allocated_ptr = false;
else
abort();
}
};
/** Throw on creation with probability specified in parameter.
* Allocates some memory in constructor and deallocates in desctructor.
* It will check correct destruction of the state.
* This is intended to check for exception safety.
*/
class AggregateFunctionThrow final : public IAggregateFunctionDataHelper<AggregateFunctionThrowData, AggregateFunctionThrow>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册