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

            Bug ID: 84918
           Summary: Better handling of "std::cout >> 42;"
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org
  Target Milestone: ---

https://www.reddit.com/r/cpp/comments/84op5c/usability_improvements_in_gcc_8/dvs5hjj/
points out:

> What is the current error message for

std::cout >> 42;

> On older compilers this would generate roughly 100 lines of unreadable
> error messages, so I detect and fix it in the static analyzer I wrote.

Checking on godbolt.org:

#include <iostream>
void test ()
{
    std::cout >> 42;
}

we currently spew dozens of lines of diagnostics.

May be worth special-casing this, and offering a fix-it hint to convert ">>" to
"<<", if sane (and vice-versa).

Reply via email to