From 36a678276ba4f7b41a33878eeee65cf7a4948728 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 16 Feb 2020 19:07:08 +0100 Subject: [PATCH] storage/composite: no "=default" in constructor Closes https://github.com/MusicPlayerDaemon/MPD/pull/739 (essentially the same, but with a proper explanation) --- src/storage/CompositeStorage.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/storage/CompositeStorage.cxx b/src/storage/CompositeStorage.cxx index 26de24e56..9ef85f22e 100644 --- a/src/storage/CompositeStorage.cxx +++ b/src/storage/CompositeStorage.cxx @@ -179,7 +179,15 @@ CompositeStorage::Directory::MapToRelativeUTF8(std::string &buffer, return false; } -CompositeStorage::CompositeStorage() noexcept = default; +CompositeStorage::CompositeStorage() noexcept +{ + /* note: no "=default" here because members of this class are + allowed to throw during construction according to the C++ + standard (e.g. std::map), but we choose to ignore these + exceptions; if construction of std::map goes wrong, MPD has + no chance to work at all, so it's ok to std::terminate() */ +} + CompositeStorage::~CompositeStorage() = default; Storage *