From 2ee7399b6fdce0bec2ed834cf7d0cf2915a92323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20DELRIEU?= Date: Mon, 17 Oct 2016 23:30:15 +0200 Subject: [PATCH] fix compilation on gcc-6 --- test/src/unit-constructor3.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/test/src/unit-constructor3.cpp b/test/src/unit-constructor3.cpp index 357585ff1..d119625fa 100644 --- a/test/src/unit-constructor3.cpp +++ b/test/src/unit-constructor3.cpp @@ -84,17 +84,13 @@ inline bool operator==(optional_type const& lhs, optional_type const& rhs) } } -template -struct type_helper -{ - using type = T; -}; - namespace nlohmann { template <> -struct json_traits : type_helper +struct json_traits { + using type = udt::empty_type; + static json to_json(type) { return json::object(); @@ -108,8 +104,10 @@ struct json_traits : type_helper }; template <> -struct json_traits : type_helper -{ +struct json_traits +{ + using type = udt::pod_type; + static json to_json(type const& t) { return {{"a", t.a}, {"b", t.b}, {"c", t.c}}; @@ -124,8 +122,9 @@ struct json_traits : type_helper template <> struct json_traits - : type_helper { + using type = udt::bit_more_complex_type; + static json to_json(type const& t) { return json{{"a", json{t.a}}, {"b", json{t.b}}, {"c", t.c}}; @@ -139,8 +138,11 @@ struct json_traits }; template -struct json_traits> : type_helper> { - static json to_json(type const&t) +struct json_traits> +{ + using type = udt::optional_type; + + static json to_json(type const& t) { if (t) return json(*t); @@ -297,4 +299,4 @@ TEST_CASE("get<> for user-defined types", "[udt]") CHECK(*v == expected); } } -} \ No newline at end of file +}