Skip to content
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

Closed
jcelerier opened this issue Jul 5, 2024 · 12 comments
Labels
c++23 clang:frontend Language frontend issues, e.g. anything involving "Sema" duplicate Resolved as duplicate libstdc++ GNU libstdc++ C++ standard library

Comments

@jcelerier
Copy link

jcelerier commented Jul 5, 2024

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
Ex. 3:

#include <nlohmann/json.hpp>

void x(const char* s, int n)
{
  nlohmann::json::parse(s, s + n);
}

cause errors such as :

/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/tuple:956:36: error: no matching function for call to 'get'
  956 |             return __convertible<decltype(std::get<_Is>(std::declval<_UTuple>()))...>();
      |                                           ^~~~~~~~~~~~~
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/tuple:955:11: note: in instantiation of function template specialization 'std::tuple<const std::basic_string<char> &>::__convertible_from_tuple_like()::(anonymous class)::operator()<0UL>' requested here
  955 |           return []<size_t... _Is>(index_sequence<_Is...>) {
      |                  ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/tuple:1136:22: note: in instantiation of function template specialization 'std::tuple<const std::basic_string<char> &>::__convertible_from_tuple_like<const std::basic_string<char> &>' requested here
 1136 |         constexpr explicit(!__convertible_from_tuple_like<_UTuple>())
      |                             ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_map.h:514:38: note: while substituting deduced template arguments into function template 'tuple' [with _UTuple = const key_type &]
  514 |                                             std::tuple<const key_type&>(__k),
      |                                                                         ^
/usr/include/nlohmann/detail/input/json_sax.hpp:442:66: note: in instantiation of member function 'std::map<std::basic_string<char>, nlohmann::basic_json<>, std::less<void>>::operator[]' requested here
  442 |             object_element = &(ref_stack.back()->m_value.object->operator[](val) = discarded);
      |                                                                  ^
/usr/include/nlohmann/detail/input/parser.hpp:219:56: note: in instantiation of member function 'nlohmann::detail::json_sax_dom_callback_parser<nlohmann::basic_json<>>::key' requested here
  219 |                         if (JSON_HEDLEY_UNLIKELY(!sax->key(m_lexer.get_string())))
      |                                                        ^
/usr/include/nlohmann/detail/input/parser.hpp:98:13: note: in instantiation of function template specialization 'nlohmann::detail::parser<nlohmann::basic_json<>, nlohmann::detail::iterator_input_adapter<const char *>>::sax_parse_internal<nlohmann::detail::json_sax_dom_callback_parser<nlohmann::basic_json<>>>' requested here
   98 |             sax_parse_internal(&sdp);
      |             ^
/usr/include/nlohmann/json.hpp:4029:113: note: in instantiation of member function 'nlohmann::detail::parser<nlohmann::basic_json<>, nlohmann::detail::iterator_input_adapter<const char *>>::parse' requested here
 4029 |         parser(detail::input_adapter(std::move(first), std::move(last)), cb, allow_exceptions, ignore_comments).parse(true, result);
      |                                                                                                                 ^
/usr/include/nlohmann/json.hpp:5138:28: note: in instantiation of function template specialization 'nlohmann::basic_json<>::parse<const char *>' requested here
 5138 |     return nlohmann::json::parse(s, s + n);
      |                            ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:122:5: note: candidate template ignored: could not match 'tuple' against 'basic_string'
  122 |     get(tuple<_Elements...>& __t) noexcept;
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:126:5: note: candidate template ignored: could not match 'tuple' against 'basic_string'
  126 |     get(const tuple<_Elements...>& __t) noexcept;
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:130:5: note: candidate template ignored: could not match 'tuple' against 'basic_string'
  130 |     get(tuple<_Elements...>&& __t) noexcept;
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:134:5: note: candidate template ignored: could not match 'tuple' against 'basic_string'
  134 |     get(const tuple<_Elements...>&& __t) noexcept;
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:138:5: note: candidate template ignored: could not match 'array' against 'basic_string'
  138 |     get(array<_Tp, _Nm>&) noexcept;
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:142:5: note: candidate template ignored: could not match 'array' against 'basic_string'
  142 |     get(array<_Tp, _Nm>&&) noexcept;
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:146:5: note: candidate template ignored: could not match 'array' against 'basic_string'
  146 |     get(const array<_Tp, _Nm>&) noexcept;
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:150:5: note: candidate template ignored: could not match 'array' against 'basic_string'
  150 |     get(const array<_Tp, _Nm>&&) noexcept;
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1250:5: note: candidate template ignored: could not match 'pair' against 'basic_string'
 1250 |     get(pair<_Tp1, _Tp2>& __in) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1255:5: note: candidate template ignored: could not match 'pair' against 'basic_string'
 1255 |     get(pair<_Tp1, _Tp2>&& __in) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1260:5: note: candidate template ignored: could not match 'pair' against 'basic_string'
 1260 |     get(const pair<_Tp1, _Tp2>& __in) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1265:5: note: candidate template ignored: could not match 'pair' against 'basic_string'
 1265 |     get(const pair<_Tp1, _Tp2>&& __in) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/ranges_util.h:444:5: note: candidate template ignored: could not match 'subrange' against 'basic_string'
  444 |     get(const subrange<_It, _Sent, _Kind>& __r)
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/ranges_util.h:455:5: note: candidate template ignored: could not match 'subrange' against 'basic_string'
  455 |     get(subrange<_It, _Sent, _Kind>&& __r)
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1272:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Tp'
 1272 |     get(pair<_Tp, _Up>& __p) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1277:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Tp'
 1277 |     get(const pair<_Tp, _Up>& __p) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1282:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Tp'
 1282 |     get(pair<_Tp, _Up>&& __p) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1287:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Tp'
 1287 |     get(const pair<_Tp, _Up>&& __p) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1292:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Tp'
 1292 |     get(pair<_Up, _Tp>& __p) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1297:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Tp'
 1297 |     get(const pair<_Up, _Tp>& __p) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1302:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Tp'
 1302 |     get(pair<_Up, _Tp>&& __p) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1307:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Tp'
 1307 |     get(const pair<_Up, _Tp>&& __p) noexcept
      |     ^
1 warning and 1 error generated.

@github-actions github-actions bot added the clang Clang issues not falling into any other category label Jul 5, 2024
@BertalanD
Copy link
Member

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?

@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" libstdc++ GNU libstdc++ C++ standard library and removed clang Clang issues not falling into any other category labels Jul 5, 2024
@llvmbot
Copy link

llvmbot commented Jul 5, 2024

@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 &lt;boost/container/flat_map.hpp&gt;

int main() {
  boost::container::flat_map&lt;int, int&gt; f;
  f[0];
}' &gt; foo.cpp

$  clang++ foo.cpp -std=c++23 -I /src/boost_1_85_0

Ex. 2: martinus/unordered_dense#119
Ex. 3:

#include &lt;nlohmann/json.hpp&gt;

void x(const char* s, int n)
{
  nlohmann::json::parse(s, s + n);
}

cause errors such as :

/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/tuple:956:36: error: no matching function for call to 'get'
  956 |             return __convertible&lt;decltype(std::get&lt;_Is&gt;(std::declval&lt;_UTuple&gt;()))...&gt;();
      |                                           ^~~~~~~~~~~~~
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/tuple:955:11: note: in instantiation of function template specialization 'std::tuple&lt;const std::basic_string&lt;char&gt; &amp;&gt;::__convertible_from_tuple_like()::(anonymous class)::operator()&lt;0UL&gt;' requested here
  955 |           return []&lt;size_t... _Is&gt;(index_sequence&lt;_Is...&gt;) {
      |                  ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/tuple:1136:22: note: in instantiation of function template specialization 'std::tuple&lt;const std::basic_string&lt;char&gt; &amp;&gt;::__convertible_from_tuple_like&lt;const std::basic_string&lt;char&gt; &amp;&gt;' requested here
 1136 |         constexpr explicit(!__convertible_from_tuple_like&lt;_UTuple&gt;())
      |                             ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_map.h:514:38: note: while substituting deduced template arguments into function template 'tuple' [with _UTuple = const key_type &amp;]
  514 |                                             std::tuple&lt;const key_type&amp;&gt;(__k),
      |                                                                         ^
/usr/include/nlohmann/detail/input/json_sax.hpp:442:66: note: in instantiation of member function 'std::map&lt;std::basic_string&lt;char&gt;, nlohmann::basic_json&lt;&gt;, std::less&lt;void&gt;&gt;::operator[]' requested here
  442 |             object_element = &amp;(ref_stack.back()-&gt;m_value.object-&gt;operator[](val) = discarded);
      |                                                                  ^
/usr/include/nlohmann/detail/input/parser.hpp:219:56: note: in instantiation of member function 'nlohmann::detail::json_sax_dom_callback_parser&lt;nlohmann::basic_json&lt;&gt;&gt;::key' requested here
  219 |                         if (JSON_HEDLEY_UNLIKELY(!sax-&gt;key(m_lexer.get_string())))
      |                                                        ^
/usr/include/nlohmann/detail/input/parser.hpp:98:13: note: in instantiation of function template specialization 'nlohmann::detail::parser&lt;nlohmann::basic_json&lt;&gt;, nlohmann::detail::iterator_input_adapter&lt;const char *&gt;&gt;::sax_parse_internal&lt;nlohmann::detail::json_sax_dom_callback_parser&lt;nlohmann::basic_json&lt;&gt;&gt;&gt;' requested here
   98 |             sax_parse_internal(&amp;sdp);
      |             ^
/usr/include/nlohmann/json.hpp:4029:113: note: in instantiation of member function 'nlohmann::detail::parser&lt;nlohmann::basic_json&lt;&gt;, nlohmann::detail::iterator_input_adapter&lt;const char *&gt;&gt;::parse' requested here
 4029 |         parser(detail::input_adapter(std::move(first), std::move(last)), cb, allow_exceptions, ignore_comments).parse(true, result);
      |                                                                                                                 ^
/usr/include/nlohmann/json.hpp:5138:28: note: in instantiation of function template specialization 'nlohmann::basic_json&lt;&gt;::parse&lt;const char *&gt;' requested here
 5138 |     return nlohmann::json::parse(s, s + n);
      |                            ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:122:5: note: candidate template ignored: could not match 'tuple' against 'basic_string'
  122 |     get(tuple&lt;_Elements...&gt;&amp; __t) noexcept;
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:126:5: note: candidate template ignored: could not match 'tuple' against 'basic_string'
  126 |     get(const tuple&lt;_Elements...&gt;&amp; __t) noexcept;
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:130:5: note: candidate template ignored: could not match 'tuple' against 'basic_string'
  130 |     get(tuple&lt;_Elements...&gt;&amp;&amp; __t) noexcept;
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:134:5: note: candidate template ignored: could not match 'tuple' against 'basic_string'
  134 |     get(const tuple&lt;_Elements...&gt;&amp;&amp; __t) noexcept;
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:138:5: note: candidate template ignored: could not match 'array' against 'basic_string'
  138 |     get(array&lt;_Tp, _Nm&gt;&amp;) noexcept;
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:142:5: note: candidate template ignored: could not match 'array' against 'basic_string'
  142 |     get(array&lt;_Tp, _Nm&gt;&amp;&amp;) noexcept;
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:146:5: note: candidate template ignored: could not match 'array' against 'basic_string'
  146 |     get(const array&lt;_Tp, _Nm&gt;&amp;) noexcept;
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:150:5: note: candidate template ignored: could not match 'array' against 'basic_string'
  150 |     get(const array&lt;_Tp, _Nm&gt;&amp;&amp;) noexcept;
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1250:5: note: candidate template ignored: could not match 'pair' against 'basic_string'
 1250 |     get(pair&lt;_Tp1, _Tp2&gt;&amp; __in) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1255:5: note: candidate template ignored: could not match 'pair' against 'basic_string'
 1255 |     get(pair&lt;_Tp1, _Tp2&gt;&amp;&amp; __in) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1260:5: note: candidate template ignored: could not match 'pair' against 'basic_string'
 1260 |     get(const pair&lt;_Tp1, _Tp2&gt;&amp; __in) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1265:5: note: candidate template ignored: could not match 'pair' against 'basic_string'
 1265 |     get(const pair&lt;_Tp1, _Tp2&gt;&amp;&amp; __in) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/ranges_util.h:444:5: note: candidate template ignored: could not match 'subrange' against 'basic_string'
  444 |     get(const subrange&lt;_It, _Sent, _Kind&gt;&amp; __r)
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/ranges_util.h:455:5: note: candidate template ignored: could not match 'subrange' against 'basic_string'
  455 |     get(subrange&lt;_It, _Sent, _Kind&gt;&amp;&amp; __r)
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1272:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Tp'
 1272 |     get(pair&lt;_Tp, _Up&gt;&amp; __p) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1277:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Tp'
 1277 |     get(const pair&lt;_Tp, _Up&gt;&amp; __p) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1282:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Tp'
 1282 |     get(pair&lt;_Tp, _Up&gt;&amp;&amp; __p) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1287:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Tp'
 1287 |     get(const pair&lt;_Tp, _Up&gt;&amp;&amp; __p) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1292:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Tp'
 1292 |     get(pair&lt;_Up, _Tp&gt;&amp; __p) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1297:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Tp'
 1297 |     get(const pair&lt;_Up, _Tp&gt;&amp; __p) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1302:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Tp'
 1302 |     get(pair&lt;_Up, _Tp&gt;&amp;&amp; __p) noexcept
      |     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/stl_pair.h:1307:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Tp'
 1307 |     get(const pair&lt;_Up, _Tp&gt;&amp;&amp; __p) noexcept
      |     ^
1 warning and 1 error generated.

@jwakely
Copy link
Contributor

jwakely commented Jul 9, 2024

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).

@BertalanD
Copy link
Member

Sounds reasonable to me, sorry if my comment sounded demanding. Let me take a stab at it.

@jwakely
Copy link
Contributor

jwakely commented Jul 9, 2024

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.

@BertalanD
Copy link
Member

Bisect part 1 done: this is the commit where it broke: bba6ea8

@BertalanD
Copy link
Member

@jwakely 128b3b6 is the commit that fixed this

@jwakely
Copy link
Contributor

jwakely commented Jul 9, 2024

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.

@jwakely
Copy link
Contributor

jwakely commented Jul 9, 2024

I suggested a possible workaround in GCC bugzilla, but I can't test it right now

@BertalanD
Copy link
Member

Duplicate of #59827

@BertalanD BertalanD marked this as a duplicate of #59827 Jul 12, 2024
@BertalanD BertalanD closed this as not planned Won't fix, can't repro, duplicate, stale Jul 12, 2024
@BertalanD
Copy link
Member

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.

@EugeneZelenko EugeneZelenko added duplicate Resolved as duplicate c++23 labels Jul 12, 2024
@jwakely
Copy link
Contributor

jwakely commented Jul 12, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++23 clang:frontend Language frontend issues, e.g. anything involving "Sema" duplicate Resolved as duplicate libstdc++ GNU libstdc++ C++ standard library
Projects
None yet
Development

No branches or pull requests

5 participants