<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Louis, in that case, I suggest you just revert the change to <map>.  That is, I see two possibilities here —</div><div><br></div><div>(1) Gauthier's change to the core compiler is broken in a subtle way that just happened to break our recent change to <map>, or</div><div>(2) Arthur (me)'s change to <map> is broken in a subtle way that just happened to exploit the core compiler bug that Gauthier was fixing (which, incidentally, was reported by me)</div><div><br></div><div>— and I think (2) is vastly more likely than (1).</div><div><br></div><div>Unfortunately, we might need Richard Smith or Mike Spertus to explain exactly what's wrong with my change to <map>. :(</div><div><br></div><div>–Arthur</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 17, 2019 at 10:37 PM Louis Dionne <<a href="mailto:ldionne@apple.com">ldionne@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div>+ Gauthier</div><div><br></div>This is the culprit:<div><br></div><div><div>commit a27d26e290545ff0686c0d08975baa53b9a4878b</div><div>Author: Gauthier Harnisch <<a href="mailto:tyker1@outlook.com" target="_blank">tyker1@outlook.com</a>></div><div>Date:   Fri Jun 14 08:40:04 2019 +0000</div><div><br></div><div>    [clang] Fixing incorrect implicit deduction guides (PR41549)</div><div><br></div><div>    Summary:</div><div>    [[ <a href="https://bugs.llvm.org/show_bug.cgi?id=41549" target="_blank">https://bugs.llvm.org/show_bug.cgi?id=41549</a> | bug report ]]</div><div><br></div><div>    Before this patch, implicit deduction guides were generated from the first declaration found by lookup.</div><div>    With this patch implicit deduction guides are generated from the definition of the class template.</div><div>    Also added test that was previously failing.</div><div><br></div><div>    Reviewers: rsmith</div><div><br></div><div>    Reviewed By: rsmith</div><div><br></div><div>    Subscribers: cfe-commits, Quuxplusone</div><div><br></div><div>    Tags: #clang</div><div><br></div><div>    Differential Revision: <a href="https://reviews.llvm.org/D63072" target="_blank">https://reviews.llvm.org/D63072</a></div><div><br><blockquote type="cite"><div>On Jun 17, 2019, at 17:20, Michał Górny <<a href="mailto:mgorny@gentoo.org" target="_blank">mgorny@gentoo.org</a>> wrote:</div><br class="gmail-m_-4213072650819352593Apple-interchange-newline"><div><span style="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;text-decoration:none;float:none;display:inline">On Mon, 2019-06-17 at 17:02 -0400, Louis Dionne wrote:</span><br style="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;text-decoration:none"><blockquote type="cite" style="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;text-decoration:none"><blockquote type="cite">On Jun 17, 2019, at 15:46, Louis Dionne via libcxx-commits <<a href="mailto:libcxx-commits@lists.llvm.org" target="_blank">libcxx-commits@lists.llvm.org</a>> wrote:<br><br><br><br><blockquote type="cite">On Jun 17, 2019, at 14:50, Michał Górny <<a href="mailto:mgorny@gentoo.org" target="_blank">mgorny@gentoo.org</a>> wrote:<br><br>On Mon, 2019-06-17 at 13:49 -0400, Arthur O'Dwyer wrote:<br><blockquote type="cite">On Mon, Jun 17, 2019 at 12:30 PM Michał Górny via Phabricator <<br><a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>> wrote:<br><br><blockquote type="cite">mgorny added a comment.<br><br>Marshall, `std/containers/associative/map/map.cons/deduct_const.pass.cpp`<br>test seems to be reliably failing from commit one on both Gentoo Linux and<br>NetBSD. Could you please look at the classical example of totally cryptic<br>C++ error? ;-)<br><br><br><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" target="_blank">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><br></blockquote><br>Well, I can contribute that that's the error that you get when CTAD deduces<br>the wrong thing. Here it's looking at lines 98–100 of deduct_const.pass.cpp<br><br> std::map m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} },<br>test_allocator<PC>(0, 45));<br> ASSERT_SAME_TYPE(decltype(m), std::map<int, long, std::less<int>,<br>test_allocator<PC>>);<br><br>and deducing the correct value_type for `m`, but it's incorrectly thinking<br>that `test_allocator<PC>` should be used as the *comparator* type, not<br>the *allocator<br>*type.  This is surprising/incorrect, because if all is going as expected,<br>then CTAD should be considering the deduction guides<br><br>template<class _Key, class _Tp, class _Compare = less<typename<br>remove_const<_Key>::type>,<br>      class _Allocator = allocator<pair<const _Key, _Tp>>,<br>      class = typename enable_if<!__is_allocator<_Compare>::value,<br>void>::type,<br>      class = typename enable_if<__is_allocator<_Allocator>::value,<br>void>::type><br>map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator =<br>_Allocator())<br>-> map<typename remove_const<_Key>::type, _Tp, _Compare, _Allocator>;<br><br>template<class _Key, class _Tp, class _Allocator,<br>      class = typename enable_if<__is_allocator<_Allocator>::value,<br>void>::type><br>map(initializer_list<pair<_Key, _Tp>>, _Allocator)<br>-> map<typename remove_const<_Key>::type, _Tp, less<typename<br>remove_const<_Key>::type>, _Allocator>;<br><br>CTAD should see that the first guide fails substitution because<br>__is_allocator<test_allocator<PC>>::value (that is, test_allocator should<br>not be taken as the comparator type).<br>CTAD should see that the second guide does not fail substitution, so CTAD<br>should unambiguously use the second guide.<br><br>The test passes on OSX using clang trunk.  I don't see any #ifdefs or<br>anything in include/ or in test/support/test_allocator.h that would cause<br>different behavior on Linux or NetBSD.  If you try clang trunk on Linux or<br>NetBSD, do you see different behavior (versus what you see with clang<br>9.0.0)?<br></blockquote><br>This is trunk.  On NetBSD, it's tested using a single tree with<br>cxx_under_test being pointed to just-built clang.  On Gentoo, I was<br>testing out-of-source build against ~same revision of trunk (± delay<br>between fetching the two repos separately).<br><br>And yes, I'm surprised that Debian buildbots don't hit this.<br></blockquote><br>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.<br></blockquote><br>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.<br><br></blockquote><br style="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;text-decoration:none"><span style="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;text-decoration:none;float:none;display:inline">Oh, and I was wondering if everybody had to hack in just-built clang</span><br style="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;text-decoration:none"><span style="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;text-decoration:none;float:none;display:inline">like I did ;-).  Thanks for looking into it.</span><br style="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;text-decoration:none"><br style="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;text-decoration:none"><br style="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;text-decoration:none"><span style="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;text-decoration:none;float:none;display:inline">--<span class="gmail-m_-4213072650819352593Apple-converted-space"> </span></span><br style="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;text-decoration:none"><span style="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;text-decoration:none;float:none;display:inline">Best regards,</span><br style="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;text-decoration:none"><span style="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;text-decoration:none;float:none;display:inline">Michał Górny</span></div></blockquote></div><br></div></div></blockquote></div></div></div></div>