This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12964] New: string literal is treated as "const char[]" in conditional expression
- From: "rdabrowa at poczta dot onet dot pl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Nov 2003 15:53:45 -0000
- Subject: [Bug c++/12964] New: string literal is treated as "const char[]" in conditional expression
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Consider the following C++ code (file is "ts.cc"):
void f(int n)
{
char *s = n ? "foo" : "bar";
}
Compiler unexpectedly reports error:
ts.cc: In function `void f(int)':
ts.cc:3: invalid conversion from `const char*' to `char*'
--
Summary: string literal is treated as "const char[]" in
conditional expression
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rdabrowa at poczta dot onet dot pl
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12964