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

            Bug ID: 69924
           Summary: gcc5.2 compile Error: std::basic_istream: no match for
                    'operator>>', while gcc 4.8 works
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: derrick at ca dot ibm.com
  Target Milestone: ---

For the following code, it compiles successfully on gcc 4.8, but fails on gcc
5.2

#include <iostream>
#include <locale>

inline int operator<<(void*,       const std::locale&) { return 1; }
inline int operator>>(void*,       const std::locale&) { return 1; }
inline int operator<<(bool,        const std::locale&) { return 2; }
inline int operator>>(bool,        const std::locale&) { return 2; }

int main(int argc, char *argv[])
{

          std::locale loc;
          if((std::cin  >> loc)!=1)
             return 1;
          if((std::cout << loc)!=1);
             return 1;

          return 0;
}

error: no match for 'operator>>' (operand types are 'std::istream {aka
std::basic_istream<char>}' and 'std::locale')
    if((std::cin  >> loc)!=1)
error: cannot bind 'std::istream {aka std::basic_istream<char>}' lvalue to
'std::basic_istream<char>&&'
    if((std::cin  >> loc)!=1)

Reply via email to