[vcpkg] Fix gcc-9 warning (#7816)

* drop one usage of span in export. Span is not appropriate for rvalues

* Add back reference

* Fix @ubsan 's comments
This commit is contained in:
Curtis J Bezault 2019-08-21 14:23:15 -07:00 committed by GitHub
parent 34a26540b1
commit 94ef325828
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -339,12 +339,13 @@ namespace vcpkg::Export
struct OptionPair struct OptionPair
{ {
const std::string& name; const StringLiteral& name;
Optional<std::string>& out_opt; Optional<std::string>& out_opt;
}; };
const auto options_implies = const auto options_implies = [&](const StringLiteral& main_opt_name,
[&](const std::string& main_opt_name, bool main_opt, Span<const OptionPair> implying_opts) { bool is_main_opt,
if (main_opt) const std::initializer_list<OptionPair>& implying_opts) {
if (is_main_opt)
{ {
for (auto&& opt : implying_opts) for (auto&& opt : implying_opts)
opt.out_opt = maybe_lookup(options.settings, opt.name); opt.out_opt = maybe_lookup(options.settings, opt.name);