[Bug c++/12964] string literal is treated as "const char[]" in conditional expression

gdr at integrable-solutions dot net gcc-bugzilla@gcc.gnu.org
Sat Nov 8 20:51:00 GMT 2003


------- 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



More information about the Gcc-bugs mailing list