https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67796
Bug ID: 67796 Summary: Definition for custom std::swap found by ADL but not used Product: gcc Version: 5.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rkirchge at gmail dot com Target Milestone: --- I am trying to use ADL to find a custom implementation of swap for tuples of an reference types. I am compiling with "-std=c++14 -Wall -Wextra". Without the following definition, the compiler reports that it cannot find the function required. With the code, the compilation succeeds without warning but "ADL works" does not print. namespace std { template <typename... T> void swap(std::tuple<T&...> lhs, std::tuple<T&...> rhs) noexcept { std::cout<<"ADL works!"<<std::endl; std::tuple<T...> tmp = lhs; lhs = rhs; rhs = tmp; } >From my tests the swap function being used when I include the above code behaves as: auto tmp = lhs; lhs = rhs; rhs = lhs; But since these are std::tuples of reference types, the temporary value created is also a tuple of reference types, so it does not work as I intend.