http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49481

           Summary: Warn about string literal + character
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: veks...@il.ibm.com


Consider:

  void f(const std::string &a, std::string & b)
  {
     b+= "_" + a[1];
  }

Although syntactically correct, this code is most certainly buggy:
this is not Java and "_" is not a string object.

When compiling C++, and maybe C,  and gcc encounteres
   <string literal> operator+ <char value> 
it should issue a warning.

Reply via email to