diff --git a/toml/datetime.hpp b/toml/datetime.hpp index 52da865..f0ae405 100644 --- a/toml/datetime.hpp +++ b/toml/datetime.hpp @@ -353,15 +353,15 @@ struct local_datetime explicit local_datetime(const std::chrono::system_clock::time_point& tp) { const auto t = std::chrono::system_clock::to_time_t(tp); - std::tm time = detail::localtime_s(&t); + std::tm ltime = detail::localtime_s(&t); - this->date = local_date(time); - this->time = local_time(time); + this->date = local_date(ltime); + this->time = local_time(ltime); // std::tm lacks subsecond information, so diff between tp and tm // can be used to get millisecond & microsecond information. const auto t_diff = tp - - std::chrono::system_clock::from_time_t(std::mktime(&time)); + std::chrono::system_clock::from_time_t(std::mktime(<ime)); this->time.millisecond = static_cast( std::chrono::duration_cast(t_diff).count()); this->time.microsecond = static_cast( diff --git a/toml/parser.hpp b/toml/parser.hpp index f345d3b..da7a201 100644 --- a/toml/parser.hpp +++ b/toml/parser.hpp @@ -1363,7 +1363,7 @@ parse_inline_table(location& loc) table retval; if(!(loc.iter() != loc.end() && *loc.iter() == '{')) { - return err(format_underline("[error] toml::parse_inline_table: ", + return err(format_underline("[error] toml::parse_inline_table: ", {{std::addressof(loc), "the next token is not an inline table"}})); } loc.advance(); @@ -1672,12 +1672,12 @@ result parse_ml_table(location& loc) const auto newline = skip_line::invoke(loc); if(!newline && loc.iter() != loc.end()) { - const auto before = loc.iter(); + const auto before2 = loc.iter(); lex_ws::invoke(loc); // skip whitespace const auto msg = format_underline("[error] toml::parse_table: " "invalid line format", {{std::addressof(loc), concat_to_string( "expected newline, but got '", show_char(*loc.iter()), "'.")}}); - loc.reset(before); + loc.reset(before2); return err(msg); } diff --git a/toml/result.hpp b/toml/result.hpp index 4930140..c7a304d 100644 --- a/toml/result.hpp +++ b/toml/result.hpp @@ -113,21 +113,25 @@ struct result { auto tmp = ::new(std::addressof(this->succ)) success_type(s); assert(tmp == std::addressof(this->succ)); + (void)tmp; } result(const failure_type& f): is_ok_(false) { auto tmp = ::new(std::addressof(this->fail)) failure_type(f); assert(tmp == std::addressof(this->fail)); + (void)tmp; } result(success_type&& s): is_ok_(true) { auto tmp = ::new(std::addressof(this->succ)) success_type(std::move(s)); assert(tmp == std::addressof(this->succ)); + (void)tmp; } result(failure_type&& f): is_ok_(false) { auto tmp = ::new(std::addressof(this->fail)) failure_type(std::move(f)); assert(tmp == std::addressof(this->fail)); + (void)tmp; } template @@ -135,24 +139,28 @@ struct result { auto tmp = ::new(std::addressof(this->succ)) success_type(s.value); assert(tmp == std::addressof(this->succ)); + (void)tmp; } template result(const failure& f): is_ok_(false) { auto tmp = ::new(std::addressof(this->fail)) failure_type(f.value); assert(tmp == std::addressof(this->fail)); + (void)tmp; } template result(success&& s): is_ok_(true) { auto tmp = ::new(std::addressof(this->succ)) success_type(std::move(s.value)); assert(tmp == std::addressof(this->succ)); + (void)tmp; } template result(failure&& f): is_ok_(false) { auto tmp = ::new(std::addressof(this->fail)) failure_type(std::move(f.value)); assert(tmp == std::addressof(this->fail)); + (void)tmp; } result& operator=(const success_type& s) @@ -161,6 +169,7 @@ struct result this->is_ok_ = true; auto tmp = ::new(std::addressof(this->succ)) success_type(s); assert(tmp == std::addressof(this->succ)); + (void)tmp; return *this; } result& operator=(const failure_type& f) @@ -169,6 +178,7 @@ struct result this->is_ok_ = false; auto tmp = ::new(std::addressof(this->fail)) failure_type(f); assert(tmp == std::addressof(this->fail)); + (void)tmp; return *this; } result& operator=(success_type&& s) @@ -177,6 +187,7 @@ struct result this->is_ok_ = true; auto tmp = ::new(std::addressof(this->succ)) success_type(std::move(s)); assert(tmp == std::addressof(this->succ)); + (void)tmp; return *this; } result& operator=(failure_type&& f) @@ -185,6 +196,7 @@ struct result this->is_ok_ = false; auto tmp = ::new(std::addressof(this->fail)) failure_type(std::move(f)); assert(tmp == std::addressof(this->fail)); + (void)tmp; return *this; } @@ -195,6 +207,7 @@ struct result this->is_ok_ = true; auto tmp = ::new(std::addressof(this->succ)) success_type(s.value); assert(tmp == std::addressof(this->succ)); + (void)tmp; return *this; } template @@ -204,6 +217,7 @@ struct result this->is_ok_ = false; auto tmp = ::new(std::addressof(this->fail)) failure_type(f.value); assert(tmp == std::addressof(this->fail)); + (void)tmp; return *this; } template @@ -213,6 +227,7 @@ struct result this->is_ok_ = true; auto tmp = ::new(std::addressof(this->succ)) success_type(std::move(s.value)); assert(tmp == std::addressof(this->succ)); + (void)tmp; return *this; } template @@ -222,6 +237,7 @@ struct result this->is_ok_ = false; auto tmp = ::new(std::addressof(this->fail)) failure_type(std::move(f.value)); assert(tmp == std::addressof(this->fail)); + (void)tmp; return *this; } @@ -233,11 +249,13 @@ struct result { auto tmp = ::new(std::addressof(this->succ)) success_type(other.as_ok()); assert(tmp == std::addressof(this->succ)); + (void)tmp; } else { auto tmp = ::new(std::addressof(this->fail)) failure_type(other.as_err()); assert(tmp == std::addressof(this->fail)); + (void)tmp; } } result(result&& other): is_ok_(other.is_ok()) @@ -246,11 +264,13 @@ struct result { auto tmp = ::new(std::addressof(this->succ)) success_type(std::move(other.as_ok())); assert(tmp == std::addressof(this->succ)); + (void)tmp; } else { auto tmp = ::new(std::addressof(this->fail)) failure_type(std::move(other.as_err())); assert(tmp == std::addressof(this->fail)); + (void)tmp; } } @@ -261,11 +281,13 @@ struct result { auto tmp = ::new(std::addressof(this->succ)) success_type(other.as_ok()); assert(tmp == std::addressof(this->succ)); + (void)tmp; } else { auto tmp = ::new(std::addressof(this->fail)) failure_type(other.as_err()); assert(tmp == std::addressof(this->fail)); + (void)tmp; } } template @@ -275,11 +297,13 @@ struct result { auto tmp = ::new(std::addressof(this->succ)) success_type(std::move(other.as_ok())); assert(tmp == std::addressof(this->succ)); + (void)tmp; } else { auto tmp = ::new(std::addressof(this->fail)) failure_type(std::move(other.as_err())); assert(tmp == std::addressof(this->fail)); + (void)tmp; } } @@ -290,11 +314,13 @@ struct result { auto tmp = ::new(std::addressof(this->succ)) success_type(other.as_ok()); assert(tmp == std::addressof(this->succ)); + (void)tmp; } else { auto tmp = ::new(std::addressof(this->fail)) failure_type(other.as_err()); assert(tmp == std::addressof(this->fail)); + (void)tmp; } is_ok_ = other.is_ok(); return *this; @@ -306,11 +332,13 @@ struct result { auto tmp = ::new(std::addressof(this->succ)) success_type(std::move(other.as_ok())); assert(tmp == std::addressof(this->succ)); + (void)tmp; } else { auto tmp = ::new(std::addressof(this->fail)) failure_type(std::move(other.as_err())); assert(tmp == std::addressof(this->fail)); + (void)tmp; } is_ok_ = other.is_ok(); return *this; @@ -324,11 +352,13 @@ struct result { auto tmp = ::new(std::addressof(this->succ)) success_type(other.as_ok()); assert(tmp == std::addressof(this->succ)); + (void)tmp; } else { auto tmp = ::new(std::addressof(this->fail)) failure_type(other.as_err()); assert(tmp == std::addressof(this->fail)); + (void)tmp; } is_ok_ = other.is_ok(); return *this; @@ -341,11 +371,13 @@ struct result { auto tmp = ::new(std::addressof(this->succ)) success_type(std::move(other.as_ok())); assert(tmp == std::addressof(this->succ)); + (void)tmp; } else { auto tmp = ::new(std::addressof(this->fail)) failure_type(std::move(other.as_err())); assert(tmp == std::addressof(this->fail)); + (void)tmp; } is_ok_ = other.is_ok(); return *this; diff --git a/toml/utility.hpp b/toml/utility.hpp index 238a87d..b6414e7 100644 --- a/toml/utility.hpp +++ b/toml/utility.hpp @@ -79,7 +79,7 @@ std::string concat_to_string(Ts&& ... args) template T from_string(const std::string& str, U&& opt) { - T v(std::forward(opt)); + T v(static_cast(std::forward(opt))); std::istringstream iss(str); iss >> v; return v; diff --git a/toml/value.hpp b/toml/value.hpp index e1cced5..cad416b 100644 --- a/toml/value.hpp +++ b/toml/value.hpp @@ -48,6 +48,7 @@ class value { const auto tmp = ::new(std::addressof(dst)) T(std::forward(v)); assert(tmp == std::addressof(dst)); + (void)tmp; } using region_base = detail::region_base;