This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]