[gnu.g++.bug] const int *, int * not overloadable

zweig@m.cs.uiuc.edu (05/25/89)

It seems like G++ isn't able to tell the difference between a pointer and a const
pointer (i.e. pointer to something you're not allowed to change) for purposes of
operator overloading. For example:

	overload f;
	int f(const int * i)
	{
		return (*i);
	}
	
	int f(int * i)
	{
		return (*i);
	}

produces the error messages:

	In function f (int *):
	tmp.cc:8: conflicting types for `int f (int *)'
	tmp.cc:3: previous declaration of `int f (const int *)'

Thus upshot is that G++ is able to complain about my sending a const int * into
a function that takes an int * (since it might let you illegally change what's
being pointed at), but there's no way to have a function that does the right
thing both for pointers to constant- and pointers to nonconstant values.


-Johnny Zweig
 University of Illinois at Urbana-Champaign
 Department of Computer Science
--------------------------------Disclaimer:------------------------------------
   Rule 1: Don't believe everything you read.
   Rule 2: Don't believe anything you read.
   Rule 3: There is no Rule 3.
-------------------------------------------------------------------------------