Skip to content

[libc++-14] <ranges> header fails to define std::ranges::contiguous_range #54765

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

Closed
Wentzell opened this issue Apr 5, 2022 · 20 comments
Closed
Assignees
Labels
c++20 libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. release:cherry-pick-failed release:merged

Comments

@Wentzell
Copy link

Wentzell commented Apr 5, 2022

The code snippet

#include <ranges>

template <std::ranges::contiguous_range R>
void f(R r){}

compiles successfully (using -stdlib=libc++ -std=c++20) with clang-13.0.1 and clang-trunk,
but fails to compile with clang-14.0.0

<source>:3:24: error: no type named 'contiguous_range' in namespace 'std::ranges'
template <std::ranges::contiguous_range R>
          ~~~~~~~~~~~~~^
<source>:4:8: error: unknown type name 'R'
void f(R r){}
       ^
2 errors generated.
Compiler returned: 1

See https://godbolt.org/z/1na3EaeEe

@Wentzell Wentzell changed the title [libc++-14] <ranges> header failes to define std::ranges::contiguous_range [libc++-14] <ranges> header fails to define std::ranges::contiguous_range Apr 5, 2022
@EugeneZelenko EugeneZelenko added libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. c++20 and removed new issue labels Apr 5, 2022
@llvmbot
Copy link
Member

llvmbot commented Apr 5, 2022

@llvm/issue-subscribers-c-20

@DimitryAndric
Copy link
Collaborator

@ldionne maybe this has to do with commits add3ab7 and 3f43d80 just not making it into 14.0.0?

@Wentzell I'm assuming you are using the exact 14.0.0 release tag, not the release/14.x branch?

@Wentzell
Copy link
Author

Wentzell commented Apr 6, 2022

Yes this was using the exact 14.0.0 tag. I have not tried if the issue persists on 14.x

@Wentzell
Copy link
Author

I can confirm that this issue persists with 14.0.1.

@philnik777
Copy link
Contributor

philnik777 commented Apr 19, 2022

@DimitryAndric No, this has nothing to do with the span stuff, but it's the same type of error.
It looks like std::ranges::contiguous_range is guarded under _LIBCPP_HAS_NO_INCOMPLETE_RANGES, but has already been shipped in libc++ 13.
@tstellar Is there still time for LLVM 14 patches? If that's the case I'll write a patch. Otherwise I think it's not yet widely used enough to matter very much, so I wouldn't change it for libc++15 again. Although we might be able to ship ranges in LLVM 15, so it wouldn't matter in that case.

@tstellar
Copy link
Collaborator

@philnik777 We are still accepting LLVM14 patches.

@var-const
Copy link
Member

@tstellar What is the deadline for a patch to still be accepted for LLVM 14?

@tstellar
Copy link
Collaborator

@var-const Probably around June 1. June 8 is the last planned 14.0.x release.

@DavidKeller
Copy link

@philnik777 Our code base is using these concepts since clang-13. So we're particularly interested in the fix.

Is this fix just a matter of removing the _LIBCPP_HAS_NO_INCOMPLETE_RANGES guard around the concept definitions ?

@philnik777
Copy link
Contributor

No, the concepts require other parts of ranges and we'd like to keep the amount of available ranges-stuff low until we implement all of the one ranges proposal. I'll try to get the fix working in the next few days. I have been procrastinating on that a bit.

@DavidKeller
Copy link

Please let me know if I can be of any help.

ldionne pushed a commit that referenced this issue May 24, 2022
The ranges concepts were already available in libc++13, so we shouldn't guard them with `_LIBCPP_HAS_NO_INCOMPLETE_RANGES`.
Fixes #54765

Differential Revision: https://reviews.llvm.org/D124011

(cherry picked from commit b177a90)
@Wentzell
Copy link
Author

@philnik777 Thank you for looking into this!

It seems the fix was committed to main. However the issue only ever showed for the llvm 14.0.x releases.
Shouldn't the fix go into the 14.x branch?

@philnik777
Copy link
Contributor

@Wentzell The fix will go into the 14.x branch. This is also a fix for the libc++15 release, since I don't think we will complete the one ranges proposal in the libc++15 time frame. But we should get it done for libc++16. @ldionne or @tstellar (?) will put it in the 14.x branch. I don't know the process for this.

@Wentzell
Copy link
Author

Thank you for clarifying!

@tstellar
Copy link
Collaborator

tstellar commented Jun 3, 2022

@ldionne Is this Ok to backport? b177a90

@tstellar tstellar moved this from Needs Triage to Needs Review in LLVM Release Status Jun 3, 2022
@tstellar
Copy link
Collaborator

tstellar commented Jun 3, 2022

/cherry-pick b177a90

@llvmbot
Copy link
Member

llvmbot commented Jun 3, 2022

Failed to cherry-pick: b177a90

https://github.com/llvm/llvm-project/actions/runs/2432601260

Please manually backport the fix and push it to your github fork. Once this is done, please add a comment like this:

/branch <user>/<repo>/<branch>

@tstellar
Copy link
Collaborator

tstellar commented Jun 8, 2022

Is someone able to backport this to a personal branch so we can create a pull request?

@tstellar
Copy link
Collaborator

tstellar commented Jun 8, 2022

Merged: 4d039a7

@tstellar tstellar moved this from Needs Review to Done in LLVM Release Status Jun 8, 2022
@ldionne
Copy link
Member

ldionne commented Jun 8, 2022

Yeah, sorry, I forgot to comment here but I already cherry-picked to release/14.x some time ago:

commit 55e34f3b49b1485d57ba2e4b8cd88af8f7900f61
Author: Nikolas Klauser <[email protected]>
Date:   Thu May 12 15:46:18 2022 +0200

    [libc++] Always enable the ranges concepts

    The ranges concepts were already available in libc++13, so we shouldn't guard them with `_LIBCPP_HAS_NO_INCOMPLETE_RANGES`.
    Fixes https://github.com/llvm/llvm-project/issues/54765

    Differential Revision: https://reviews.llvm.org/D124011

    (cherry picked from commit b177a90ce7b590dfce6479142f46fd1b9554a3b3)

mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this issue Oct 7, 2022
The ranges concepts were already available in libc++13, so we shouldn't guard them with `_LIBCPP_HAS_NO_INCOMPLETE_RANGES`.
Fixes llvm/llvm-project#54765

Reviewed By: #libc, ldionne

Spies: ldionne, libcxx-commits

Differential Revision: https://reviews.llvm.org/D124011
arichardson pushed a commit to CTSRD-CHERI/libcxx that referenced this issue Sep 12, 2023
The ranges concepts were already available in libc++13, so we shouldn't guard them with `_LIBCPP_HAS_NO_INCOMPLETE_RANGES`.
Fixes llvm/llvm-project#54765

Reviewed By: #libc, ldionne

Spies: ldionne, libcxx-commits

Differential Revision: https://reviews.llvm.org/D124011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++20 libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. release:cherry-pick-failed release:merged
Projects
Archived in project
Development

No branches or pull requests

9 participants