[net.lang.c++] Version 1.0 type coercion problems

graham@cheviot.newcastle.ac.uk (Graham D Parrington) (08/29/86)

The following program generates an error from the 1.0 version of C++

extern void Set(char *);

void Test (char a)
{
	Set(&a);
}

The error message is:

"Test.c", line 5: error: bad argument 1 type for Set(): int * (char * expected)

The problem appears to be that the argument 'a' to Test is forced to int by
cfront so that taking its address gives an int* rather than the required
char*. Putting in an explicit coercion or assigning 'a' to a local and passing
that instead cures the problem. Unfortunately fragments of code like the
above are generated automatically by an RPC stub generator we are writing.

Does anybody have a fix for this for 1.0 and does the problem persist into
1.1?

Graham D Parrington
    Computing Lab, University of Newcastle upon Tyne, UK

ARPA:    graham%cheviot.newcastle.ac.uk@cs.ucl.ac.uk
UUCP:    <UK>!ukc!cheviot!graham