On 9/24/26 09:46, Zaphod Beeblebrox wrote:
I'm currently running FreeBSD 15.1. I found out that in c++20 you can
now say:
for(auto [i, j] : v | std::views:enumerate)
... which I would very much like to. FreeBSD 15.1 has clang 19 as standard, which supposedly support c++20 and more, but some searching
leads me to conclude that enumerate is a late addition to clang.
So I installed clang23 to see. This still kicks out the error --- but
I'm expecting this is about include files. Does clang23 come with new include files --- or can I access them. I suppose there is a similar question about libc++ ... even though this specific problem doesn't
involve the library proper, AFAIK.
Help?
For the most part, libc++ is include files. Something like std::views:enumerate would be from the libc++ headers.
The FreeBSD OS supports only its own libc++ header files, no matter
which LLVM or clang++ compiler version is in use. That includes if one
uses a devel/llvm* port (or package).
The LLVM development is not linear in C++ standard versions. There are
still things missing that are defined in c++17 (so somewhat under a
decade ago). There are other things from much more recent standard
versions that are implemented. One has to track status item by item,
rather than a C++ standard version as a a unit. (Some things have
"nothing to do" because they were implemented before the standard for whatever the issue was.)
You do not give the actual error message(s). Some of the notation in:
for(auto [i, j] : v | std::views:enumerate)
is not from libc++ and other parts of it are. There is no clue given
about which parts ended up being referenced as wrong/unsupported by the
error message(s).
For:
#include <iostream>
#include <vector>
#include <ranges>
#include <tuple>
int main() {
std::vector<std::tuple<int,uint>> t =3D {};
std::vector<int> v =3D {};
for (auto [i, j] : t) {
std::cout << "Index: " << i << ", Value: " << j << "\n";
}
for (auto [i, j] : std::views::enumerate(v)) {
std::cout << "Index: " << i << ", Value: " << j << "\n";
}
for (auto [i, j] : v | std::views::enumerate) {
std::cout << "Index: " << i << ", Value: " << j << "\n";
}
return 0;
}
On a main (a.k.a. CURRENT) FreeBSD OS I get:
# c++ -std=3Dc++23 c23_structured_binding_example.cc c23_structured_binding_example.cc:14:36: error: no member named
'enumerate' in namespace 'std::ranges::views'
14 | for (auto [i, j] : std::views::enumerate(v)) {
| ^~~~~~~~~ c23_structured_binding_example.cc:18:40: error: no member named
'enumerate' in namespace 'std::ranges::views'
18 | for (auto [i, j] : v | std::views::enumerate) {
| ^~~~~~~~~
2 errors generated.
# c++ -std=3Dc++23 -fexperimental-library \
c23_structured_binding_example.cc
c23_structured_binding_example.cc:14:36: error: no member named
'enumerate' in namespace 'std::ranges::views'
14 | for (auto [i, j] : std::views::enumerate(v)) {
| ^~~~~~~~~ c23_structured_binding_example.cc:18:40: error: no member named
'enumerate' in namespace 'std::ranges::views'
18 | for (auto [i, j] : v | std::views::enumerate) {
| ^~~~~~~~~
2 errors generated.
Those are complaints about something missing in the libc++ headers. Note
that the first "for(. . .)" got no complaints at all. Nor were there any complaints about std::views of itself.
For Reference:
# c++ -v
FreeBSD clang version 21.1.8 (https://github.com/llvm/llvm-project.git llvmorg-21.1.8-0-g2078da43e25a <https://github.com/llvm/llvm-project.gitllvmorg-21.1.8-0-g2078da43e25a>) Target: aarch64-unknown-freebsd16.0
Thread model: posix
InstalledDir: /usr/bin
https://libcxx.llvm.org/Status/Cxx23.html#cxx23-status reports:
P2164R9 views::enumerate 2023-02 (Issaquah) Complete 23 #105251
That 23 is for LLVM23 and its libc++23 being the "First released
version". Some things are incompletely implemented well before they are
fully implemented/released. -fexperimental-library sometimes allows use
of some incompletely implemented status items.
Until the FreeBSD OS version of interest is based o LLVM23 and its
libc++23 (or later versions of such), std::views::enumerate will not be operational as far as I can tell.
--
=3D=3D=3D
Mark Millard
marklmi at yahoo.com
On 9/24/26 13:25, Zaphod Beeblebrox wrote:At the moment 16-CURRENT, 15-STABLE and 14-STABLE have clang and libc++ 21.1.8. I merged 21.1.8 into 16-CURRENT on 2026-04-25, and then MFC'd it to 15-STABLE and 14-STABLE on 2026-05-30.
Yes, the complaint is about enumerate not being in the views namespace.
Same as your error.
... So I'm reading that there is no known way to grab a newer set of
libc++ and associated header files. 15.1 is clang 19, it seems. Is 16
planning to ship with clang21, or might it ship with clang23?
Unclear at this time.
https://www.freebsd.org/releng/ reports the estimate:
December 2027 FreeBSD 16.0
As stands, the ports tree has an in process:It is unrelated, the ports tree has lots of different LLVM versions, but these do not install their own copies of libc++. This is different from the various gcc ports, which each have their (possibly incompatible) versions of libstdc++.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296377
"[exp-run] update LLVM_DEFAULT to 22"
On 25 Sep 2026, at 00:22, Mark Millard <marklmi@yahoo.com> wrote:
On 9/24/26 13:25, Zaphod Beeblebrox wrote:
Yes, the complaint is about enumerate not being in the views namespace. >> Same as your error.
... So I'm reading that there is no known way to grab a newer set of
libc++ and associated header files. 15.1 is clang 19, it seems. Is 16
planning to ship with clang21, or might it ship with clang23?
Unclear at this time.
https://www.freebsd.org/releng/ reports the estimate:
December 2027 FreeBSD 16.0
At the moment 16-CURRENT, 15-STABLE and 14-STABLE have clang and libc++ 21.1.8.
I merged 21.1.8 into 16-CURRENT on 2026-04-25, and then MFC'd it to 15-STABLE and 14-STABLE on 2026-05-30.
We are now in a bit of a strange situation, that the just-released 14.5-RELEASE has clang/libc++ 21.1.8, while the somewhat older 15.1-RELEASE still has 19.1.7.
That said, libc++ 21.1.8 still doesn't have std::views::enumerate, unfortunately, so we will have to upgrade the base system to clang and libc++ 23.1 at some point.
As stands, the ports tree has an in process:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296377
"[exp-run] update LLVM_DEFAULT to 22"
It is unrelated, the ports tree has lots of different LLVM versions, but these do not install their own copies of libc++. This is different from the various gcc ports, which each have their (possibly incompatible) versions of libstdc++.
The above bug is only about bumping the default version if the user doesn't specify any specific pinned version.
That said, libc++ 21.1.8 still doesn't have std::views::enumerate, unfortunately, so we will have to upgrade the base system to clang and
libc++ 23.1 at some point.
wrote:
Le ven. 25 sept. 26 =C3=A0 9:16:42 +0200, Dimitry Andric <dim@FreeBSD.or=
=C3=A9crivait :
That said, libc++ 21.1.8 still doesn't have std::views::enumerate, unfortunately, so we will have to upgrade the base system to clang and libc++ 23.1 at some point.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 74 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 02:23:24 |
| Calls: | 1,194 |
| Files: | 1,353 |
| D/L today: |
2 files (1,590K bytes) |
| Messages: | 291,157 |