🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #957

g++ V2.2.2: conditional operator cannot handle const char * operand

#957
From: Michael T. Naseef
Date: Mon, 17 Aug 1992 10:48
29 lines
1264 bytes
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: <9208171848.AA06346@tupelo.cs.duke.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!wupost!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.duke.edu!mtn

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!wupost!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.duke.edu!mtn
From: mtn@cs.duke.edu (Michael T. Naseef)
Subject: g++ V2.2.2: conditional operator cannot handle const char * operand
Message-ID: <9208171848.AA06346@tupelo.cs.duke.edu>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 17 Aug 1992 10:48:21 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 30