Skip to content

[ADD] Add test-results for apple-clang-14 #170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

filipsajdak
Copy link
Contributor

As suggested (here #133 (comment)) I have created apple-clang-14 in test-results that compiles regression tests with:

Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

The main issue is that it does not support <ranges> - that means that there are no correct results for:

  • mixed-captures-in-expressions-and-postconditions.cpp2
  • mixed-function-expression-and-std-ranges-for-each-with-capture.cpp2
  • mixed-function-expression-and-std-ranges-for-each.cpp2
  • mixed-function-expression-with-pointer-capture.cpp2
  • mixed-function-expression-with-repeated-capture.cpp2

I have added failed .output files for them (with error):

mixed-function-expression-and-std-ranges-for-each-with-capture.cpp2:14:18: error: no member named 'for_each' in namespace 'std::ranges'
    std::ranges::for_each
    ~~~~~~~~~~~~~^
mixed-function-expression-and-std-ranges-for-each-with-capture.cpp2:18:18: error: no member named 'for_each' in namespace 'std::ranges'
    std::ranges::for_each( view, std::move(callback));
    ~~~~~~~~~~~~~^
2 errors generated.

@hsutter hsutter merged commit fec62f3 into hsutter:main Dec 21, 2022
@filipsajdak filipsajdak deleted the fsajdak-add-test-results-for-apple-clang-14 branch December 21, 2022 00:05
@hsutter
Copy link
Owner

hsutter commented Dec 21, 2022

Thanks!

No <ranges>, then? Interesting. Looking at the cppreference C++20 conformance table, I see Apple Clang is also missing <=> (spaceship), jthread, and of course <format> (the last one doesn't surprise me but the others do).

Of these, the one that concerns me most is <=>, because I was planning to soon take a hard dependency on it in emitted Cpp1 code as I add support for user-defined types... and not having that is going to be interesting because I don't want to have to emit all that pre-C++20 comparison boilerplate just to the emitted Cpp1 source works on Apple Clang. :-( The three-way comparison <=> is the first Cpp2-derived feature to be standardized in ISO C++, and I was expecting to be able to rely on its being there to generate code. Well, I know actual Clang's support for <=> is "partial" but it seemed to work as expected the last time I happened to try it in passing... maybe Apple Clang will add it in the next release.

@filipsajdak
Copy link
Contributor Author

You already use operator<=> in cppfront in common.h file:

struct source_position
{
    lineno_t    lineno;     // one-based offset into program source
    colno_t     colno;      // one-based offset into line

    source_position(lineno_t l = 1, colno_t  c = 1 )
        : lineno{ l }, colno{ c }
    {
    }

    auto operator<=>(source_position const&) const = default;

    auto to_string() const -> std::string
    {
        return "(" + std::to_string(lineno) + "," + std::to_string(colno) + ")";
    }
};

It compiles and works... does it means it is working?

@hsutter
Copy link
Owner

hsutter commented Dec 21, 2022

Right, that's in cppfront's own source. So if Apple Clang doesn't support <=> then presumably it won't be able to compile cppfront itself. If you try to compile cppfront.cpp I would expect it would break if it doesn't understand that common.h spaceship operator.

But someone using an already-compiled cppfront executable to compile some Cpp2 code to Cpp1 and using Apple Clang as the second (Cpp1) compiler will be fine, because executing cppfront doesn't currently generate <=> in the Cpp1 output (including that there's no <=> in cpp2util.h that the Cpp1 output will include).

@filipsajdak
Copy link
Contributor Author

Taking a look at https://en.cppreference.com/w/cpp/compiler_support and I see that P1185R2 is supported by apple clang 12 (I am currently using 14).

@hsutter
Copy link
Owner

hsutter commented Dec 21, 2022

Strange that it would have P1185 supported but P0515 not. Oh well, maybe the table is not consistent or up to date -- if you try to compile cppfront.cpp with Apple Clang that should tell you pretty quickly whether it supports <=>. :)

@filipsajdak
Copy link
Contributor Author

This is my main compiler, and I have been compiling cppfront with Apple clang since my first contribution to cppfront.

That is why I was surprised to see that it is not supported.

@filipsajdak
Copy link
Contributor Author

That means apple clang has support for operator <=> and you don't have to change your plans.

@hsutter
Copy link
Owner

hsutter commented Dec 21, 2022

Thanks. I'll ping Sergey and let him know he might want to update cppreference.

Azmah-Bad pushed a commit to Azmah-Bad/cppfront that referenced this pull request Feb 24, 2023
…lts-for-apple-clang-14

[ADD] Add test-results for apple-clang-14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants