[forwarded from http://bugs.debian.org/203351] The g++-3.3 parser fails to parse the code bellow with the following error message: test.cc:33: error: declaration of `Bitmap::operator GdkBitmap*() const' test.cc:23: error: conflicts with previous declaration `Bitmap::operator GdkBitmap*() const' This code compiles cleanly with g++-3.2. Some changes to the code, e.g. move the class Event to the end of the file, makes the file to compile cleanly with g++-3.3. The problem also exists in current HEAD. //////////////////////// Code starts here ////////////////////////////////////// typedef struct _GdkDrawable GdkDrawable; typedef struct _GdkDrawable GdkBitmap; typedef struct _GdkDrawable GdkPixmap; class Drawable { public: operator GdkDrawable* () const; }; class Pixmap : public Drawable { public: operator GdkPixmap* () const; }; class Bitmap : public Pixmap { public: operator GdkBitmap* () const; }; class Event { }; Bitmap::operator GdkBitmap* () const { return 0; } ///// Code ends here ///////////
I can confirm this on the mainline (20030729) and 3.3.1 (20030707). From Phil's regression hunter: : Search converges between 2003-06-14-trunk (#313) and 2003-06-22-trunk (#314). : Search converges between 2003-06-14-3.3 (#145) and 2003-06-22-3.3 (#146).
A binchop with Janis' script shows that the problem was introduced on the gcc-3_3-branch between 2003-06-17 23:57 UTC and 2003-06-18 00:00 UTC
Mark, It appears that your patch: 2003-06-17 Mark Mitchell <mark@codesourcery.com> PR c++/11105 * cp-tree.h (DECL_CONV_FN_TYPE): New method. * decl.c (lookup_name_real): Backport conversion operator code from mainline. * mangle.c (struct globals): Remove internal_mangling_p. (write_unqualified_name): Use DECL_CONV_FN_TYPE. (write_template_parm): Don't write out the level number. (conv_type_names): New variable. (hash_type): New function. (compare_type): Likewise. (mangle_conv_op_name_for_type): Don't try to mangle conversion operator names. * search.c (lookup_conversion_operator): New function. (lookup_fnfields_1): Use it. has introduced this rejects-valid regression on the branch and mainline. This is a regression from 3.3.0, so this really should be fixed before 3.3.1 goes out. Hope it can be done.
Subject: Bug 11713 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: mmitchel@gcc.gnu.org 2003-08-04 11:25:39 Modified files: gcc/cp : ChangeLog search.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/overload: operator1.C Log message: PR c++/11713 * search.c (setup_class_bindings): Handle conversion operators specially. PR c++/11713 * g++.dg/overload/operator1.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.189&r2=1.3076.2.190 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/search.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.243.2.15&r2=1.243.2.16 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.245&r2=1.2261.2.246 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/overload/operator1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
Subject: Bug 11713 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2003-08-04 11:30:06 Modified files: gcc/cp : search.c Added files: gcc/testsuite/g++.dg/overload: operator1.C Log message: PR c++/11713 * search.c (setup_class_bindings): Handle conversion operators specially. PR c++/11713 * g++.dg/overload/operator1.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/search.c.diff?cvsroot=gcc&r1=1.277&r2=1.278 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/overload/operator1.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
Fixed in GCC 3.3.1, GCC 3.4.