This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
regression on 2.8.1: type conv. overld problem
- To: egcs-bugs at cygnus dot com
- Subject: regression on 2.8.1: type conv. overld problem
- From: Stefan Schwarzer <sts at ica1 dot uni-stuttgart dot de>
- Date: Mon, 22 Feb 1999 23:21:53 +0100 (MET)
// The following code demonstrates a bug (in the overload resolution?).
// In the presence of the const version
// of the user supplied type conversion to double *, egcs does not compile the appended code.
// (This is a regression against gcc-2.8.1 which compiles the code without complaints)
//
// Without the const version of operator double *, things work as expected.
// With KCC or cxx, the code compiles in both cases without problems.
//
// I do not include preprocessor output, because it is basically identical to the source.
//
// Reading specs from /local/egcs-1.1.1/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.60/specs
// gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
// (name sqangling compiled in)
//
// The bug is still present in the 1.1.2 pre1 (with squangling)
//
// 20:55 boa_sts:~/bugs/gnu> g++ c_arr.cc
// c_arr.cc: In function `int main()':
// c_arr.cc:14: no match for `CArray & + int'
//
//
class CArray
{
public:
operator double* (){ return a; }
// works if we comment this line:
operator double* () const { return const_cast<double *>(a); }
private:
double a[1];
};
int main(){
CArray a;
double *pa = a + 1;
}