c++/9558: subclass cannot find parent members without explicit "this->" in some cases

Andrew Pollard andrewp@andypo.net
Tue Feb 4 01:07:00 GMT 2003


>bangerth@dealii.org wrote:
>> Synopsis: subclass cannot find parent members without explicit "this->"
>>in some cases
>> 
>> State-Changed-From-To: open->closed
>> State-Changed-By: bangerth
>> State-Changed-When: Mon Feb  3 23:45:09 2003
>> State-Changed-Why:
>>     That's how C++ works -- it's a feature, not a bug, and
>>     it's called two-stage (or dependent) name lookup.
>>     
>>     We really need to get an entry into the non-bugs page about
>>     this, we are getting far too many reports about this...
>>     
>>     W.
>
>If that's how C++ works in the official spec, it's not how it works in 
>real life.

That may be the case, but that's no reason to say that the standard isn't
correct.

>I've got half a million lines of code in Unreal Tournament 2003 that 
>this "feature" breaks, which compile fine on everything from CodeWarrior 
>to Intel's compiler to Visual C to GCC 2.95.3, 3.1, and 3.2. I can list 
>at least five other games I've worked on that this breaks. I do not 
>control or write this code, I just port it.
>
>Surely there's got to be some consideration for backwards compatibility, 
>if not real world issues?
>
>--ryan.

Some sort of diagnostic would be good. I personally would welcome it.

I've just ported our 4M lines of code to the gcc-3.4 parser (and rather
surprisingly, it didn't cause a great deal of problems...) Funny thing
is, I never really realised the reason behind the change that the
standard proposed (until I saw it and asked). I think that this should
be a FAQ of some sort...

The thing that made made me accept the change was that I altered a
whole load of our code that had not even been used due to the fact
that the time of binding had changed. We had syntax errors, etc..

[ My colleagues, who happen to be Windows programmers, think that this
 change is completely against all good ideas for programming.. I partly
 agree with them, but I have been following gcc since pre-egcs, so I
 know how to make code conformant......, but if they think VC++-6.0
 is a compiler...., well what can I say...?
]

Andrew.
--
 Andrew Pollard, Brooks-PRI Automation  | home: andrew@andypo.net
670 Eskdale Road, Winnersh Triangle, UK | work: Andrew.Pollard@brooks-pri.com
 Tel/Fax:+44 (0)118 9215603 / 9215660   | http://www.andypo.net



More information about the Gcc-bugs mailing list