Merge pull request #1826 from cbegue/develop

Add restriction for tuple specialization of to_json
This commit is contained in:
Niels Lohmann 2019-11-05 19:14:37 +01:00 committed by GitHub
commit 1ca6f2901b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 6 deletions

View file

@ -1842,6 +1842,12 @@ TEST_CASE("regression tests")
static_assert(!std::is_constructible<json, std::pair<NotSerializableData, std::string>>::value, "");
static_assert(std::is_constructible<json, std::pair<int, std::string>>::value, "");
}
SECTION("issue #1825 - A tuple<Args..> is json constructible only if all T in Args are json constructible")
{
static_assert(!std::is_constructible<json, std::tuple<std::string, NotSerializableData>>::value, "");
static_assert(!std::is_constructible<json, std::tuple<NotSerializableData, std::string>>::value, "");
static_assert(std::is_constructible<json, std::tuple<int, std::string>>::value, "");
}
}
#if not defined(JSON_NOEXCEPTION)