Article View: gnu.g++.bug
Article #810Re: g++ V2.2.2: conditional operator cannot handle const char * operand
From: Mike Stump
Date: Sat, 29 Aug 1992 12:59
Date: Sat, 29 Aug 1992 12:59
37 lines
1507 bytes
1507 bytes
This problem should not exist in the next release of gcc.
> Date: Mon, 17 Aug 92 14:48:21 -0400
> From: mtn@cs.duke.edu (Michael T. Naseef)
> Message-Id: <9208171848.AA06346@tupelo.cs.duke.edu>
> To: bug-gcc@prep.ai.mit.edu
> Cc: khera@cs.duke.edu
> SOFTWARE: g++ (gcc) version 2.2.2
> BUG REPORT: conditional operator ?: cannot handle const char * operand.
> I discovered the following bug while recompiling groff using g++
> version 2.2.2.
> PROBLEM: compiling the following code produces the error
> try.cc: In function `int main ()':
> try.cc:5: assignment between incompatible pointer types
> EXAMPLE CODE:
> main()
> {
> const char *p = "abcd";
> const char *c;
> c = ((p == 0) ? "1234" : p);
> }
> Note: changing the declaration of p to char * will allow g++ to compile the
> code without error. No casting of any members has any affect on the problem.
> Mike Naseef
> --
> Mike Naseef
> Department of Computer Science, Duke University, Durham, NC 27706
> Internet: mtn@cs.duke.edu | Phone: 919/660-6577
> UUCP: mcnc!duke!mtn |
Technical Details
Message-ID:
<9208291259.AA28595@cygnus.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!mrsShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!mrs From: mrs@cygnus.com (Mike Stump) Subject: Re: g++ V2.2.2: conditional operator cannot handle const char * operand Message-ID: <9208291259.AA28595@cygnus.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Sat, 29 Aug 1992 12:59:35 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 40