https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99692

Sergey Kaniskin <skaniskin at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libstdc++                   |c++

--- Comment #8 from Sergey Kaniskin <skaniskin at gmail dot com> ---
Thanks to Junekey Jeon, I have an example that does not overload operator<< for
a member of std.

#include <iostream>
#include <vector>

struct CustomStream : std::ostream {};

namespace N {
    class A{};
}

std::ostream& operator<<(std::ostream& s, const N::A&) 
{
    return s;
}

CustomStream&& operator<<(CustomStream&& s, const N::A& v)  
{
    static_cast<std::ostream&>(s) << v;
    return std::move(s);
}

int main() 
{
    CustomStream() << N::A{};
}

Reply via email to