[Bug libstdc++/60448] swap_ranges does not use ADL correctly

2014-03-07 Thread public at alisdairm dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60448 --- Comment #14 from Alisdair Meredith --- Among other things, it lets fools like me write code relying on a behavior, not realizing that the code is not portable. As a user I swing between the convenience of having that utility, vs. the inconven

[Bug libstdc++/60448] swap_ranges does not use ADL correctly

2014-03-07 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60448 --- Comment #13 from Marc Glisse --- (In reply to Jonathan Wakely from comment #10) > (In reply to Marc Glisse from comment #6) > > libc++ sfinae constrains std::swap. > > Aha! I suppose we could do that too, Indeed. I could never estimate the

[Bug libstdc++/60448] swap_ranges does not use ADL correctly

2014-03-07 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60448 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug libstdc++/60448] swap_ranges does not use ADL correctly

2014-03-07 Thread public at alisdairm dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60448 --- Comment #11 from Alisdair Meredith --- Created attachment 32298 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32298&action=edit Portable test of ADL on local type Agreed, not-a-bug. For completeness, I attach a final test case that doe

[Bug libstdc++/60448] swap_ranges does not use ADL correctly

2014-03-07 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60448 --- Comment #10 from Jonathan Wakely --- (In reply to Marc Glisse from comment #6) > libc++ sfinae constrains std::swap. Aha! I suppose we could do that too, but that would be an enhancement (and have to wait until after the 4.9 release), but ap

[Bug libstdc++/60448] swap_ranges does not use ADL correctly

2014-03-06 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60448 --- Comment #9 from Marc Glisse --- (In reply to Alisdair Meredith from comment #8) > I am still surprised that I get an error for calling the move > operations of 'local' though (in the second example) rather than getting an > ambiguous lookup.

[Bug libstdc++/60448] swap_ranges does not use ADL correctly

2014-03-06 Thread public at alisdairm dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60448 --- Comment #8 from Alisdair Meredith --- I agree with Mark's analysis. I was trying to force use of swap on a local class, and found a pattern that worked for libc++ but missed that neither template would be more specialized - my original attemp

[Bug libstdc++/60448] swap_ranges does not use ADL correctly

2014-03-06 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60448 --- Comment #7 from Marc Glisse --- (In reply to Marc Glisse from comment #6) > libc++ sfinae constrains std::swap. More precisely: they do have swap declared before iter_swap, if you remove the =delete it is ambiguous with libc++ as well, it jus

[Bug libstdc++/60448] swap_ranges does not use ADL correctly

2014-03-06 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60448 --- Comment #6 from Marc Glisse --- libc++ sfinae constrains std::swap.

[Bug libstdc++/60448] swap_ranges does not use ADL correctly

2014-03-06 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60448 --- Comment #5 from Jonathan Wakely --- Slightly different version of that last test: namespace tagged { template struct Swappable {}; #ifndef NO_CUSTOM_SWAP template void swap(Swappable & a, Swappable & b) { static_cast(a).swap(static_cas

[Bug libstdc++/60448] swap_ranges does not use ADL correctly

2014-03-06 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60448 --- Comment #4 from Jonathan Wakely --- Looks like the difference between libc++ and libstdc++ is whether std::swap() is declared before std::swap_ranges or not, this reproduces the same behaviour, with swapper replacing swap_ranges: namespace ta

[Bug libstdc++/60448] swap_ranges does not use ADL correctly

2014-03-06 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60448 --- Comment #3 from Jonathan Wakely --- I don't understand what we can be doing wrong in the library, we just call std::iter_swap(it1, it2) which calls swap(*it1, *it2) unqualified.

[Bug libstdc++/60448] swap_ranges does not use ADL correctly

2014-03-06 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60448 --- Comment #2 from Jonathan Wakely --- (In reply to Alisdair Meredith from comment #1) > Created attachment 32287 [details] > Cleaner tagging scheme for the local class > > Simplified the example to more directly expose the local class via ADL >

[Bug libstdc++/60448] swap_ranges does not use ADL correctly

2014-03-06 Thread public at alisdairm dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60448 --- Comment #1 from Alisdair Meredith --- Created attachment 32287 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32287&action=edit Cleaner tagging scheme for the local class Simplified the example to more directly expose the local class via