diff --git a/include/rfl/Literal.hpp b/include/rfl/Literal.hpp index eff9ffed..bd9ec0c8 100644 --- a/include/rfl/Literal.hpp +++ b/include/rfl/Literal.hpp @@ -45,10 +45,6 @@ class Literal { Literal(const std::string& _str) : value_(find_value(_str).value()) {} - /// A single-field literal is special because it - /// can also have a default constructor. - template > Literal() : value_(0) {} ~Literal() = default; diff --git a/tests/json/test_duration_default.cpp b/tests/json/test_duration_default.cpp new file mode 100644 index 00000000..a7fe15ea --- /dev/null +++ b/tests/json/test_duration_default.cpp @@ -0,0 +1,19 @@ +#include +#include +#include + +#include "rfl/DefaultIfMissing.hpp" +#include "write_and_read.hpp" + +namespace test_duration_default { + +struct TestStruct { + std::chrono::seconds duration; +}; + +TEST(json, test_duration_default) { + const auto test = TestStruct{.duration = std::chrono::seconds(10)}; + write_and_read( + test, R"({"duration":{"count":10,"unit":"seconds"}})"); +} +} // namespace test_duration_default