Bug 16560 - [4.0 Regression] error with inner class declaring operator=
Summary: [4.0 Regression] error with inner class declaring operator=
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 critical
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2004-07-15 09:23 UTC by larsbj
Modified: 2004-10-30 21:12 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target:
Build:
Known to work: 3.3.3 3.4.1
Known to fail: 4.0.0
Last reconfirmed: 2004-07-15 11:52:04


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description larsbj 2004-07-15 09:23:13 UTC
This snippet works with gcc 3.3 and 3.4, but fails on 3.5.

g++ (GCC) 3.5.0 20040715 (experimental)

class Foo {};

class Bar : public Foo {
public:
	struct Item {
		Item & operator=(Item const &);
	};
};


g++ -c test.C -o test.o
test.C:3: error: declaration of `Bar& Bar::operator=(const Bar&)'
test.C:1: error: conflicts with previous declaration `Foo& Foo::operator=(const
Foo&)'


Please tell if you need the preprocessed sources.
Comment 1 Wolfgang Bangerth 2004-07-15 11:51:58 UTC
Confirmed. Note that the compiler error refers to the operator= in class 
Bar, not Bar::Item. If one removes the declaration in Bar::Item, then the 
error message goes away. It looks as if someone was looking up a name in 
the wrong scope. 
 
Mark, could this be related to your push_/pop_* work? 
 
W. 
Comment 2 Andrew Pinski 2004-07-15 14:16:33 UTC
Guess what I saw something like this when compiling QT also.
Comment 3 Mark Mitchell 2004-07-15 16:02:49 UTC
I failed to check in the name-lookup.c changes that I posted here:

  http://gcc.gnu.org/ml/gcc-patches/2004-07/msg01493.html

Those changes fix this problem.

I've now applied that patch.