Commit 1a26afab049bb75c0523a754d62b961439248d44

Authored by Henry Schreiner
Committed by GitHub
1 parent e88700a6

fixi: include windows 2022 (#748)

* ci: include windows 2022

* fix visual studio 2022 issue with std::array and type detection

* style: pre-commit.ci fixes

* warning fixes

Co-authored-by: Philip Top <top1@llnl.gov>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Philip Top <phlptp@gmail.com>
azure-pipelines.yml
... ... @@ -57,10 +57,14 @@ jobs:
57 57 Windows11:
58 58 vmImage: "windows-2019"
59 59 cli11.std: 11
60   - WindowsLatest:
61   - vmImage: "windows-2019"
  60 + Windows20:
  61 + vmImage: "windows-2022"
62 62 cli11.std: 20
63   - cli11.options: -DCMAKE_CXX_FLAGS="/std:c++latest /EHsc"
  63 + cli11.options: -DCMAKE_CXX_FLAGS="/EHsc"
  64 + WindowsLatest:
  65 + vmImage: "windows-2022"
  66 + cli11.std: 23
  67 + cli11.options: -DCMAKE_CXX_FLAGS="/EHsc"
64 68 Linux17nortti:
65 69 vmImage: "ubuntu-latest"
66 70 cli11.std: 17
... ...
include/CLI/TypeTools.hpp
... ... @@ -655,7 +655,8 @@ struct classify_object&lt;
655 655 typename std::enable_if<is_tuple_like<T>::value &&
656 656 ((type_count<T>::value >= 2 && !is_wrapper<T>::value) ||
657 657 (uncommon_type<T>::value && !is_direct_constructible<T, double>::value &&
658   - !is_direct_constructible<T, int>::value))>::type> {
  658 + !is_direct_constructible<T, int>::value) ||
  659 + (uncommon_type<T>::value && type_count<T>::value >= 2))>::type> {
659 660 static constexpr object_category value{object_category::tuple_value};
660 661 // the condition on this class requires it be like a tuple, but on some compilers (like Xcode) tuples can be
661 662 // constructed from just the first element so tuples of <string, int,int> can be constructed from a string, which
... ...
tests/HelpersTest.cpp
... ... @@ -1228,6 +1228,8 @@ TEST_CASE(&quot;Types: LexicalConversionTuple3&quot;, &quot;[helpers]&quot;) {
1228 1228 TEST_CASE("Types: LexicalConversionTuple4", "[helpers]") {
1229 1229 CLI::results_t input = {"9.12", "19", "18.6", "5.87"};
1230 1230 std::array<double, 4> x;
  1231 + auto tsize = CLI::detail::type_count<decltype(x)>::value;
  1232 + CHECK(tsize == 4);
1231 1233 bool res = CLI::detail::lexical_conversion<decltype(x), decltype(x)>(input, x);
1232 1234 CHECK(res);
1233 1235 CHECK(19 == Approx(std::get<1>(x)));
... ...