Closed jcelerier closed 2 months ago
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)
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?
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: https://github.com/llvm/llvm-project/commit/bba6ea8c2d56faad49936b95a57c7499095b920b
@jwakely https://github.com/llvm/llvm-project/commit/128b3b61fe6768c724975fd1df2be0abec848cf6 is the commit that fixed this
So is this just a dup of #59827?
I think what changed is that libstdc++ now uses explicit(bool)
more widely in C++23 mode.
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: https://github.com/boostorg/container/issues/282
Repro:
Ex. 2: https://github.com/martinus/unordered_dense/issues/119 Ex. 3:
cause errors such as :