Bug 11713 - [3.3/3.4 regression] declaration conflicts
Summary: [3.3/3.4 regression] declaration conflicts
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3.1
: P1 critical
Target Milestone: 3.3.1
Assignee: Mark Mitchell
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2003-07-29 19:45 UTC by Debian GCC Maintainers
Modified: 2004-01-17 04:22 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-07-29 19:51:51


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Debian GCC Maintainers 2003-07-29 19:45:16 UTC
[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 ///////////
Comment 1 Andrew Pinski 2003-07-29 19:51:51 UTC
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).
Comment 2 Steven Bosscher 2003-07-30 10:34:18 UTC
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
Comment 3 Steven Bosscher 2003-07-30 12:03:37 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.
Comment 5 GCC Commits 2003-08-04 11:30:10 UTC
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

Comment 6 Mark Mitchell 2003-08-04 11:32:29 UTC
Fixed in GCC 3.3.1, GCC 3.4.