From 349fb30e8e3f381d4e79732f85095ea2bb8ba8db Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sat, 22 Sep 2018 16:15:49 +0300 Subject: [PATCH] Remove the user-provided ~error_category in C++03 mode, to fix use after main --- include/boost/system/error_code.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/boost/system/error_code.hpp b/include/boost/system/error_code.hpp index a740dfd..7d68e11 100644 --- a/include/boost/system/error_code.hpp +++ b/include/boost/system/error_code.hpp @@ -196,9 +196,12 @@ protected: #else - ~error_category() - { - } + // We'd like to make the destructor protected, to make code that deletes + // an error_category* not compile; unfortunately, doing the below makes + // the destructor user-provided and hence breaks use after main, as the + // categories may get destroyed before code that uses them + + // ~error_category() {} #endif