From 25f196098ecec862103ae9a7ea62b250d4d0b97f Mon Sep 17 00:00:00 2001 From: Chenliang Xu Date: Sat, 27 Sep 2014 21:28:00 -0500 Subject: [PATCH] Disable copy constructor of Session Since only one instance of Catch::Session can ever be used. While trying to call session in my own function, I made a mistake of passing session object by value. It called copy constructor and destructor later, which called Catch::clean(). Disabling copy constructor of session can prevent similar mistakes. --- include/catch_runner.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/catch_runner.hpp b/include/catch_runner.hpp index e6303d88..d51ebe12 100644 --- a/include/catch_runner.hpp +++ b/include/catch_runner.hpp @@ -100,6 +100,10 @@ namespace Catch { class Session { static bool alreadyInstantiated; + private: + // Prevent copy constructor + Session(const Session& other); + public: struct OnUnusedOptions { enum DoWhat { Ignore, Fail }; };