-
Notifications
You must be signed in to change notification settings - Fork 12k
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
clang++, libstdc++14, std=c++23 : lots of library code in mainstream libraries fails to build #97842
Comments
Ran across the same thing in one of my projects; updating to Clang 18 fixed the compilation errors. Clang 17 won't be getting any updates (19 is just around the corner), maybe it would be worth asking libstdc++ developers to add a workaround on their side? |
@llvm/issue-subscribers-clang-frontend Author: Jean-Michaël Celerier (jcelerier)
Some repros ; easily reproducible on an archlinux container.
Ex. 1: boostorg/container#282 Repro: $ docker run -v $PWD:/src -it archlinux:latest
$ pacman -Sy
$ pacman -S clang
$ echo '#include <boost/container/flat_map.hpp>
int main() {
boost::container::flat_map<int, int> f;
f[0];
}' > foo.cpp
$ clang++ foo.cpp -std=c++23 -I /src/boost_1_85_0 Ex. 2: martinus/unordered_dense#119 #include <nlohmann/json.hpp>
void x(const char* s, int n)
{
nlohmann::json::parse(s, s + n);
} cause errors such as :
|
I'll consider patches to do so, but I'm not going to spend my own time working around bugs in "old" versions of Clang (I know 17 isn't very old, but if you want to use -std=c++23 then you can also use a version of Clang where that works better). |
Sounds reasonable to me, sorry if my comment sounded demanding. Let me take a stab at it. |
No, don't worry - it's a reasonable request, and we do try to support clang. I just don't know what the problem is here, and so don't know how to solve it. If somebody knows (or can bisect to find out) which Clang change fixed this, then that might help to come up with a workaround. |
Bisect part 1 done: this is the commit where it broke: bba6ea8 |
So is this just a dup of #59827? I think what changed is that libstdc++ now uses |
I suggested a possible workaround in GCC bugzilla, but I can't test it right now |
Duplicate of #59827 |
I tried searching in Bugzilla, but I didn't find the workaround you mentioned. Was I looking in the wrong place? Anyway, this issue is even less vital now that Arch Linux is finally shipping Clang 18 in their repos. |
Weird, I can't find it now either, so I wonder where I added that comment! The suggestion I apparently never made was: diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def
index 0604bc2c520..fc2fa0c195f 100644
--- a/libstdc++-v3/include/bits/version.def
+++ b/libstdc++-v3/include/bits/version.def
@@ -1766,6 +1766,7 @@ ftms = {
values = {
v = 202207;
cxxmin = 23;
+ extra_cond = "! defined __clang__ || __clang > 17";
};
};
diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h
index e9ccc116f9f..e83e79596e1 100644
--- a/libstdc++-v3/include/bits/version.h
+++ b/libstdc++-v3/include/bits/version.h
@@ -1939,7 +1939,7 @@
#undef __glibcxx_want_to_underlying
#if !defined(__cpp_lib_tuple_like)
-# if (__cplusplus >= 202100L)
+# if (__cplusplus >= 202100L) && (! defined __clang__ || __clang > 17)
# define __glibcxx_tuple_like 202207L
# if defined(__glibcxx_want_all) || defined(__glibcxx_want_tuple_like)
# define __cpp_lib_tuple_like 202207L |
Some repros ; easily reproducible on an archlinux container.
Ex. 1: boostorg/container#282
Repro:
Ex. 2: martinus/unordered_dense#119
Ex. 3:
cause errors such as :
The text was updated successfully, but these errors were encountered: