diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-02-15 21:42:03 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-02-18 11:12:12 +0300 |
commit | 35e6070f143375ec61b8f0f14cb214e87a077171 (patch) | |
tree | 8b69bfe05937e5b31c21f8636ea689888ac0ab2f /src/node_options-inl.h | |
parent | 45b7c98f09bca9716c20f855f38b8dd6aba66ef0 (diff) |
src: remove invalid casts in options parser
Fixes: https://github.com/nodejs/node/issues/26131
PR-URL: https://github.com/nodejs/node/pull/26139
Reviewed-By: Yang Guo <yangguo@chromium.org>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/node_options-inl.h')
-rw-r--r-- | src/node_options-inl.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/node_options-inl.h b/src/node_options-inl.h index f482bcd3666..052c847f7eb 100644 --- a/src/node_options-inl.h +++ b/src/node_options-inl.h @@ -148,7 +148,7 @@ void OptionsParser<Options>::Implies(const std::string& from, CHECK_NE(it, options_.end()); CHECK_EQ(it->second.type, kBoolean); implications_.emplace(from, Implication { - std::static_pointer_cast<OptionField<bool>>(it->second.field), true + it->second.field, true }); } @@ -159,7 +159,7 @@ void OptionsParser<Options>::ImpliesNot(const std::string& from, CHECK_NE(it, options_.end()); CHECK_EQ(it->second.type, kBoolean); implications_.emplace(from, Implication { - std::static_pointer_cast<OptionField<bool>>(it->second.field), false + it->second.field, false }); } @@ -205,8 +205,7 @@ auto OptionsParser<Options>::Convert( typename OptionsParser<ChildOptions>::Implication original, ChildOptions* (Options::* get_child)()) { return Implication { - std::static_pointer_cast<OptionField<bool>>( - Convert(original.target_field, get_child)), + Convert(original.target_field, get_child), original.target_value }; } @@ -378,8 +377,10 @@ void OptionsParser<Options>::Parse( { auto implications = implications_.equal_range(name); - for (auto it = implications.first; it != implications.second; ++it) - *it->second.target_field->Lookup(options) = it->second.target_value; + for (auto it = implications.first; it != implications.second; ++it) { + *it->second.target_field->template Lookup<bool>(options) = + it->second.target_value; + } } const OptionInfo& info = it->second; |