Savior-of-Cross's blog

By Savior-of-Cross, history, 3 years ago, In English

Not sure if this has been mentioned before, but the following code involving std::inclusive_scan doesn't compile on CF on both "GNU G++17 7.3.0" and "GNU G++17 9.2.0 (64bit, msys 2)". This function is part of the C++17 standard, according to the reference, so it should compile on both versions (and it does compile locally).

inclusive_scan

std::exclusive_scan doesn't compile on CF as well.

exclusive_scan
  • Vote: I like it
  • +17
  • Vote: I do not like it

»
3 years ago, # |
Rev. 2   Vote: I like it +21 Vote: I do not like it

Standard support != compiler support :(

As far as I see, inclusive_scan start exists with GCC-9. But only overloads with ExecutionPolicy.
And there is another surprise: GCC-9 don't know about execution header Click

So your code start working from GCC-10 Click

  • »
    »
    3 years ago, # ^ |
    Rev. 2   Vote: I like it +36 Vote: I do not like it

    It does seem to compile on GCC 9.3, for instance, see https://godbolt.org/z/Yq1Wqes59.

    It seems to be the case that the MinGW implementation might not have the corresponding function for std::inclusive_scan or std::exclusive_scan, since a closer look at the compiler error (in custom invocation) shows that there are no overloads other than those with an execution policy in the pstl.

    UPD: For some reason I forgot that the GCC version used on CF is 9.2.0, and not 9.3.0 (and the same compilation error appears on godbolt as well).

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Standard support != compiler support :(

    I've always thought that every implementation must obey the standard....

    So your code start working from GCC-10

    Weird. My local is gcc 9.3.0 and both of these codes compiles

    version

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +37 Vote: I do not like it

      Apparently it hadn't been implemented in GCC 9.2.0 (but works in 9.3.0), which is pretty sad. I believe CF should update the compilers to a more modern compiler (maybe GCC 11?), and (what is unrelated), perhaps to C++20 (when it's more stable).

    • »
      »
      »
      3 years ago, # ^ |
      Rev. 2   Vote: I like it -10 Vote: I do not like it

      I've always thought that every implementation must obey the standard....

      Sure in perfect world...
      C++20 already exists for smth about year but there is no one compiler fully supporting it (for syntax maybe, but declared new functions — it is questions to standard library developers [library != compiler]).

      Weird. My local is gcc 9.3.0 and both of these codes compiles

      Maybe on your computer another c++ library (don't know how to know for sure, but there is libc++ and there is libstdc++, maybe on one it was supported but not on another)