Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2021-10-12 17:40:02 +0300
committerJulian Eisel <julian@blender.org>2021-10-12 17:40:02 +0300
commita2daf92a57e45039fe928a9bc6251e8f8fc2bd6d (patch)
tree2ca0abc580a9300bc5fdfefc37995f30abd8f58f /source/blender
parent1db42c9b7967507d5d3ac688fb1a4a36bfac5f95 (diff)
Fix warning about deleted default constructor declared as default
Since `AssetCatalogPath` isn't default constructible (unlike the previous `CatalogPath`, alias `std::string`), `AssetCatalog` isn't default constructible either. But its default constructor is declared with `= default` which Apple Clang was warning about. Differential Revision: https://developer.blender.org/D12714 Reviewed by: Sybren Stüvel
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_asset_catalog_path.hh4
-rw-r--r--source/blender/blenkernel/intern/asset_catalog_path_test.cc10
2 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_asset_catalog_path.hh b/source/blender/blenkernel/BKE_asset_catalog_path.hh
index 054b7853140..f51232334f2 100644
--- a/source/blender/blenkernel/BKE_asset_catalog_path.hh
+++ b/source/blender/blenkernel/BKE_asset_catalog_path.hh
@@ -56,12 +56,12 @@ class AssetCatalogPath {
/**
* The path itself, such as "Agents/Secret/327".
*/
- std::string path_;
+ std::string path_ = "";
public:
static const char SEPARATOR;
- AssetCatalogPath() = delete;
+ AssetCatalogPath() = default;
AssetCatalogPath(StringRef path);
AssetCatalogPath(const std::string &path);
AssetCatalogPath(const char *path);
diff --git a/source/blender/blenkernel/intern/asset_catalog_path_test.cc b/source/blender/blenkernel/intern/asset_catalog_path_test.cc
index d8da91d5d18..be50f2fc001 100644
--- a/source/blender/blenkernel/intern/asset_catalog_path_test.cc
+++ b/source/blender/blenkernel/intern/asset_catalog_path_test.cc
@@ -31,6 +31,16 @@ namespace blender::bke::tests {
TEST(AssetCatalogPathTest, construction)
{
+ AssetCatalogPath default_constructed;
+ /* Use `.str()` to use `std:string`'s comparison operators here, not our own (which are tested
+ * later). */
+ EXPECT_EQ(default_constructed.str(), "");
+
+ /* C++ considers this construction special, it doesn't call the default constructor but does
+ * recursive, member-wise value initialization. See https://stackoverflow.com/a/4982720. */
+ AssetCatalogPath value_initialized = AssetCatalogPath();
+ EXPECT_EQ(value_initialized.str(), "");
+
AssetCatalogPath from_char_literal("the/path");
const std::string str_const = "the/path";