public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49481] New: Warn about string literal + character
@ 2011-06-21 5:50 veksler at il dot ibm.com
0 siblings, 0 replies; only message in thread
From: veksler at il dot ibm.com @ 2011-06-21 5:50 UTC (permalink / raw)
To: gcc-bugs
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: unassigned@gcc.gnu.org
ReportedBy: veksler@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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-06-21 5:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-21 5:50 [Bug c++/49481] New: Warn about string literal + character veksler at il dot ibm.com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).