Skip to content

Commit abc8bf4

Browse files
committed
build: enhance clang++ C++20 usability test
clang++-17 -std=c++23 -stdlib=libstdc++ (from gcc-14) fails template deduction somehow. (Works when using v17 + -std=c++20, or v18 + -std=any). ``` In file included from x.cpp:1: In file included from /usr/include/c++/14/string:51: In file included from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/bits/stl_pair.h:410:35: error: no matching function for call to 'get' 410 | return _S_convertible<decltype(std::get<0>(std::declval<_UPair>())), /usr/include/c++/14/bits/stl_pair.h:524:22: note: in instantiation of function template specialization 'std::pair<const int, int>::_S_convertible_from_pair_like<const std::pair<const int, int> *&>' requested here 524 | constexpr explicit(!_S_convertible_from_pair_like<_UPair>()) /usr/include/c++/14/type_traits:1110:49: note: while substituting deduced template arguments into function template 'pair' [with _UPair = const std::pair<const int, int> *&] 1110 | = __bool_constant<__is_constructible(_Tp, _Args...)>; /usr/include/c++/14/type_traits:1116:16: note: in instantiation of template type alias '__is_constructible_impl' requested here 1116 | : public __is_constructible_impl<_Tp, _Args...> /usr/include/c++/14/bits/hashtable_policy.h:1140:33: note: in instantiation of template class 'std::is_constructible<std::pair<const int, int>, const std::pair<const int, int> *&>' requested here 1140 | using _IFcons = std::enable_if<__is_cons<_Pair>::value>; /usr/include/c++/14/bits/hashtable_policy.h:1143:2: note: in instantiation of template type alias '_IFcons' requested here 1143 | using _IFconsp = typename _IFcons<_Pair>::type; /usr/include/c++/14/bits/hashtable_policy.h:1153:43: note: (skipping 1 context in backtrace; use -ftemplate-backtrace-limit=0 to see all) 1153 | template<typename _Pair, typename = _IFconsp<_Pair>> /usr/include/c++/14/bits/hashtable_policy.h:1155:2: note: in instantiation of default argument for 'insert<const std::pair<const int, int> *&>' required here 1155 | insert(const_iterator __hint, _Pair&& __v) 1156 | { 1157 | __hashtable& __h = this->_M_conjure_hashtable(); 1158 | return __h._M_emplace(__hint, __unique_keys{}, 1159 | std::forward<_Pair>(__v)); 1160 | } /usr/include/c++/14/bits/hashtable.h:1274:15: note: while substituting deduced template arguments into function template 'insert' [with _Pair = const std::pair<const int, int> *&, $1 = (no value)] 1274 | { this->insert(__f, __l); } /usr/include/c++/14/bits/hashtable.h:585:9: note: in instantiation of function template specialization 'std::_Hashtable<int, std::pair<const int, int>, std::allocator<std::pair<const int, int>>, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true>>::_Hashtable<const std::pair<const int, int> *>' requested here 585 | : _Hashtable(__l.begin(), __l.end(), __bkt_count_hint, /usr/include/c++/14/bits/unordered_map.h:239:9: note: in instantiation of member function 'std::_Hashtable<int, std::pair<const int, int>, std::allocator<std::pair<const int, int>>, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true>>::_Hashtable' requested here 239 | : _M_h(__l, __n, __hf, __eql, __a) x.cpp:3:30: note: in instantiation of member function 'std::unordered_map<int, int>::unordered_map' requested here 3 | std::unordered_map<int, int> a{{}}; ```
1 parent 291edd7 commit abc8bf4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

configure.ac

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ for i in "" "c++26" "c++2c" "c++23" "c++2b" "c++20"; do
3434
CXXFLAGS="$saved_CXXFLAGS${i:+ -std=$i}"
3535
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
3636
#include <span>
37+
#include <unordered_map>
3738
#include <vector>
3839
int main() {
3940
std::vector<int> v{1,9};
4041
std::span s = v;
42+
std::unordered_map<int, int> um{{}};
4143
}
4244
])], [
4345
AC_MSG_RESULT([yes])

0 commit comments

Comments
 (0)