This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12964] string literal is treated as "const char[]" in conditional expression
- From: "gdr at integrable-solutions dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Nov 2003 20:51:00 -0000
- Subject: [Bug c++/12964] string literal is treated as "const char[]" in conditional expression
- References: <20031108155344.12964.rdabrowa@poczta.onet.pl>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From gdr at integrable-solutions dot net 2003-11-08 20:50 -------
Subject: Re: string literal is treated as "const char[]" in conditional expression
"rdabrowa at poczta dot onet dot pl" <gcc-bugzilla@gcc.gnu.org> writes:
| (In reply to comment #2)
| > Yes, as required by the standard [lex.string].
|
| OK sorry. But I have one more question.
| Consider similar code:
|
| void f()
| {
| const int n = 1;
| char *s = n ? "foo" : "bar";
| }
|
| Copiler does not complain. Is this correct ?
Compiler is right. GCC message is actually meaningful and does
provide clue.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12964