🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Michael T. Naseef Mon, 17 Aug 1992 10:48
g++ V2.2.2: conditional operator cannot handle const char * operand
#957
Author: 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	|
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads