<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 17, 2019, at 15:46, Louis Dionne via libcxx-commits <<a href="mailto:libcxx-commits@lists.llvm.org" class="">libcxx-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">On Jun 17, 2019, at 14:50, Michał Górny <<a href="mailto:mgorny@gentoo.org" class="">mgorny@gentoo.org</a>> wrote:<br class=""><br class="">On Mon, 2019-06-17 at 13:49 -0400, Arthur O'Dwyer wrote:<br class=""><blockquote type="cite" class="">On Mon, Jun 17, 2019 at 12:30 PM Michał Górny via Phabricator <<br class=""><a href="mailto:reviews@reviews.llvm.org" class="">reviews@reviews.llvm.org</a>> wrote:<br class=""><br class=""><blockquote type="cite" class="">mgorny added a comment.<br class=""><br class="">Marshall, `std/containers/associative/map/map.cons/deduct_const.pass.cpp`<br class="">test seems to be reliably failing from commit one on both Gentoo Linux and<br class="">NetBSD. Could you please look at the classical example of totally cryptic<br class="">C++ error? ;-)<br class=""><br class=""><br class=""><a href="http://lab.llvm.org:8011/builders/netbsd-amd64/builds/20/steps/run%20unit%20tests/logs/FAIL%3A%20libc%2B%2B%3A%3Adeduct_const.pass.cpp" class="">http://lab.llvm.org:8011/builders/netbsd-amd64/builds/20/steps/run%20unit%20tests/logs/FAIL%3A%20libc%2B%2B%3A%3Adeduct_const.pass.cpp</a><br class=""><br class=""></blockquote><br class="">Well, I can contribute that that's the error that you get when CTAD deduces<br class="">the wrong thing. Here it's looking at lines 98–100 of deduct_const.pass.cpp<br class=""><br class=""> std::map m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} },<br class="">test_allocator<PC>(0, 45));<br class=""> ASSERT_SAME_TYPE(decltype(m), std::map<int, long, std::less<int>,<br class="">test_allocator<PC>>);<br class=""><br class="">and deducing the correct value_type for `m`, but it's incorrectly thinking<br class="">that `test_allocator<PC>` should be used as the *comparator* type, not<br class="">the *allocator<br class="">*type. This is surprising/incorrect, because if all is going as expected,<br class="">then CTAD should be considering the deduction guides<br class=""><br class="">template<class _Key, class _Tp, class _Compare = less<typename<br class="">remove_const<_Key>::type>,<br class=""> class _Allocator = allocator<pair<const _Key, _Tp>>,<br class=""> class = typename enable_if<!__is_allocator<_Compare>::value,<br class="">void>::type,<br class=""> class = typename enable_if<__is_allocator<_Allocator>::value,<br class="">void>::type><br class="">map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator =<br class="">_Allocator())<br class="">-> map<typename remove_const<_Key>::type, _Tp, _Compare, _Allocator>;<br class=""><br class="">template<class _Key, class _Tp, class _Allocator,<br class=""> class = typename enable_if<__is_allocator<_Allocator>::value,<br class="">void>::type><br class="">map(initializer_list<pair<_Key, _Tp>>, _Allocator)<br class="">-> map<typename remove_const<_Key>::type, _Tp, less<typename<br class="">remove_const<_Key>::type>, _Allocator>;<br class=""><br class="">CTAD should see that the first guide fails substitution because<br class="">__is_allocator<test_allocator<PC>>::value (that is, test_allocator should<br class="">not be taken as the comparator type).<br class="">CTAD should see that the second guide does not fail substitution, so CTAD<br class="">should unambiguously use the second guide.<br class=""><br class="">The test passes on OSX using clang trunk. I don't see any #ifdefs or<br class="">anything in include/ or in test/support/test_allocator.h that would cause<br class="">different behavior on Linux or NetBSD. If you try clang trunk on Linux or<br class="">NetBSD, do you see different behavior (versus what you see with clang<br class="">9.0.0)?<br class=""></blockquote><br class="">This is trunk. On NetBSD, it's tested using a single tree with<br class="">cxx_under_test being pointed to just-built clang. On Gentoo, I was<br class="">testing out-of-source build against ~same revision of trunk (± delay<br class="">between fetching the two repos separately).<br class=""><br class="">And yes, I'm surprised that Debian buildbots don't hit this.<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">So you're hitting that with Clang trunk? This is not the kind of problem where the platform should matter, only the compiler and the libc++ version. Let me try to reproduce locally.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""></div></blockquote><div><br class=""></div><div>Yes, I can reproduce locally with Clang trunk. I think this isn't showing up in the Linux bots because they use older compilers. This must be something that was introduced recently-ish. I'll bisect.</div><div><br class=""></div><div>Louis</div><br class=""><blockquote type="cite" class=""><div class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Louis</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br class=""><blockquote type="cite" class="">Unfortunately there is no way to debug CTAD deduction guides — the error<br class="">messages don't tell you which guides were considered as candidates or which<br class="">candidate was ultimately chosen.<br class=""><br class="">–Arthur<br class=""></blockquote><br class="">--<span class="Apple-converted-space"> </span><br class="">Best regards,<br class="">Michał Górny<br class=""><br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">libcxx-commits mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="mailto:libcxx-commits@lists.llvm.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">libcxx-commits@lists.llvm.org</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-commits" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-commits</a></div></blockquote></div><br class=""></body></html>