Re: Upgrading C++ library features.

From: Mark Millard <marklmi_at_yahoo.com>
Date: Thu, 24 Sep 2026 22:22:48 UTC
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

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"

Generally FreeBSD does not progress to a new LLVM* version that breaks
much in the ports tree. So the above is also probably about updating
main to be based on LLVM22. main would use it for a while before
stable/15 would be updated.


As far as I know, FreeBSD does not normally wait to RELEASE with a
specific version of LLVM* that is not working well with the ports tree
yet. It just uses the most recent LLVM* has a known generally-working
status for the ports tree and for use in main at the time.

stable/15 imported llvm21 on 2026-05-29 and, so, 15.2-RELELASE is
supposed to be based on llvm21 as far as I can tell (not a later LLVM*).
15.2 is reported as:

December 2026 FreeBSD 15.2

Future stable/15 updates may happen after main updates and is in use for
a while --so some 15.*-RELEASE after 15.2-RELEASE may be based on LLVM23
sometime after main is based on LLVM23.

> 
> On Thu, Sep 24, 2026 at 3:48 PM Mark Millard <marklmi@yahoo.com
> <mailto:marklmi@yahoo.com>> wrote:
> 
>     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 = {};
>         std::vector<int>             v = {};
> 
>         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=c++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=c++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 <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.
> 
> 
>     -- 
>     ===
>     Mark Millard
>     marklmi at yahoo.com <http://yahoo.com>
> 


-- 
===
Mark Millard
marklmi at yahoo.com