@@ -16,7 +16,7 @@ import mcpp.platform;
1616//
1717// The first version of this helper sat at namespace scope in the module
1818// purview, which makes its declaration part of what this module's interface
19- // records. Its return type is `std::optional<std::string>`, and under clang
19+ // records. Under clang
2020// with the MSVC standard library that was enough to break every downstream
2121// translation unit that constructs one:
2222//
@@ -65,10 +65,16 @@ namespace {
6565// not invalidate a running program; equally, a new program must not invalidate
6666// published data. A manifest check has no standing to do so over an entry that
6767// may never be reached.
68- std::optional<std::string> version_req_problem (std::string_view spec) {
69- if (spec.empty ()) return std::nullopt ; // path/git/workspace deps
68+ // ⚠️ RETURNS A PLAIN STRING, EMPTY MEANING "NO PROBLEM", AND NOT AN
69+ // `std::optional<std::string>`. The optional was the obvious spelling and cost
70+ // two rounds of Windows CI: see the note on `TargetEntry::sysroot` for what
71+ // that specialisation does to importers under clang with the MSVC standard
72+ // library. Nothing here needs to distinguish an absent problem from an empty
73+ // one, so nothing is lost.
74+ std::string version_req_problem (std::string_view spec) {
75+ if (spec.empty ()) return {}; // path/git/workspace deps
7076 if (auto r = mcpp::version_req::parse_req (spec); !r) return r.error ();
71- return std:: nullopt ;
77+ return {} ;
7278}
7379
7480} // namespace
@@ -697,14 +703,14 @@ std::expected<Manifest, ManifestError> parse_string(std::string_view content,
697703 if (auto it = sub.find (" path" ); it != sub.end () && it->second .is_string ()) spec.path = it->second .as_string ();
698704 if (auto it = sub.find (" version" ); it != sub.end () && it->second .is_string ()) {
699705 spec.version = it->second .as_string ();
700- if (auto why = version_req_problem (spec.version ))
706+ if (auto why = version_req_problem (spec.version ); !why. empty () )
701707 m.schemaWarnings .push_back (std::format (
702708 " [{}.\" {}\" ] version = '{}' is not a requirement this "
703709 " resolver can match ({}). The fetch will fail naming the "
704710 " PACKAGE, which may well exist; it is this requirement that "
705711 " does not parse. Accepted: an exact version (\" 1.2.3\" ) or "
706712 " a comparator (\" ^1.2.3\" , \" >=1.0.0, <2.0.0\" )." ,
707- section, fqName, spec.version , * why));
713+ section, fqName, spec.version , why));
708714 }
709715 if (auto it = sub.find (" git" ); it != sub.end () && it->second .is_string ()) spec.git = it->second .as_string ();
710716 if (auto it = sub.find (" visibility" ); it != sub.end () && it->second .is_string ()) {
@@ -819,14 +825,14 @@ std::expected<Manifest, ManifestError> parse_string(std::string_view content,
819825 auto key = selector.stableMapKey ;
820826 if (value.is_string ()) {
821827 spec.version = value.as_string ();
822- if (auto why = version_req_problem (spec.version ))
828+ if (auto why = version_req_problem (spec.version ); !why. empty () )
823829 m.schemaWarnings .push_back (std::format (
824830 " [{}] {} = '{}' is not a requirement this resolver can "
825831 " match ({}). The fetch will fail naming the PACKAGE, which "
826832 " may well exist; it is this requirement that does not "
827833 " parse. Accepted: an exact version (\" 1.2.3\" ) or a "
828834 " comparator (\" ^1.2.3\" , \" >=1.0.0, <2.0.0\" )." ,
829- section, key, spec.version , * why));
835+ section, key, spec.version , why));
830836 } else if (value.is_table ()) {
831837 auto & sub = value.as_table ();
832838 if (!looks_like_inline_dep_spec (sub)) {
0 commit comments