Closed
Bug 15636
Opened 27 years ago
Closed 27 years ago
Cleanup build warnings
Categories
(Core Graveyard :: Tracking, defect, P3)
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: slamm, Assigned: slamm)
References
()
Details
http://tinderbox.mozilla.org/SeaMonkey/warnings.html#pierre
The warnings "<some_function> was hidden by <some_other_functon>" usually
indicate something is wrong with at least one of the class designs. Please take
a look. Be sure to click on the "See build log excerpt" link to see what was
hidden.
Now you have a bug to check in your fixes. =) I am even available to review
changes.
Updated•27 years ago
|
Status: NEW → ASSIGNED
Comment 1•27 years ago
|
||
Thanks for opening the bug report. I should have done it last month already.
Updated•27 years ago
|
Assignee: pierre → slamm
Status: ASSIGNED → NEW
Comment 2•27 years ago
|
||
We looked into it with Ramiro but we did not find an explanation nor a
workaround. It's possibly a compiler problem: the class definition really looks
valid and if it wasn't, it would have been caught on Mac too. We verified the
parameters, the retun value and the scope (protected) but everything seems
coherent. We tried as a workaround to reverse the order of the 2 definitions of
GetDesiredSize() in nsFormControlFrame.h but we still got the warning.
According to Ramiro, we have spent as much time as this problem deserves and I am
very tempted to close it as WontFixSoWhat but I'd like to first give you (slamm)
a chance to look a little bit more into it and either find out why we get these
spurious warnings or change the compiler we use to generate the Build Warnings
page (if you want my advice: use MetroWerks). So... reassigning to you.
| Assignee | ||
Comment 3•27 years ago
|
||
The warning is valid. The warning comes from only overriding one of two virtual
functions with the same name,
clase Base {
public:
int f(int);
int f(int,int);
};
class Derived : public Base {
int f(int, int);
}
In the example above, f(int) cannot be called from the Derived object. To fix
the warning, you need to override both functions. Another possible fix is to
change the name of one of the functions if that makes more sense.
http://www.cerfnet.com/~mpcline/On-Line-C++-FAQs/strange-inheritance.html#[23.3]
Updated•27 years ago
|
Assignee: slamm → pierre
Comment 4•27 years ago
|
||
The link you provide doesn't confirm what you wrote. Nowhere it mentions a
requirement to override in a derived class all the virtual functions with the
same name, but I'll give it a try. Reassigning to myself.
| Assignee | ||
Comment 5•27 years ago
|
||
The last bracket of the link gets cut off by bugzilla. I wanted to refer to
23.3. They first suggest fixing the problem with the "using" statement. I am
unsure if all our compilers would support that. That is why I suggested
redefining the unlisted function in the derived class. (This is the second
solution given in the FAQ.)
Comment 6•27 years ago
|
||
Some interesting comments from scc that confirm what slamm said...
----
Yup. It's a valid warning. A name declared in a derived class hides
|all| previous declarations of the same name, regardless of signature.
This is why over-riding and overloading don't mix. Even if all the
|f|s in your sample were virtual, |Derived::f(int, int)| would hide
|Base::f(int)|.
This is to prevent an accident where somebody adds a new method to a
base class where, coincidentally, some derived class has a function
with the same name. Without this rule, the entire meaning of the
program could be subtly changed. With this rule, the meaning is the
same, and a warning is issued.
To get around it, bring all the names into scope with |using|, e.g.,
class Derived : public Base {
using Base::f;
// bring all |f|s into scope, so I don't hide them
int f(int, int);
// now override the one I care about
}
If |using| is not allowed, then you have to override all of them.
Updated•27 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 27 years ago
Resolution: --- → FIXED
Comment 7•27 years ago
|
||
Fixed
Updated•27 years ago
|
Status: RESOLVED → REOPENED
Comment 8•27 years ago
|
||
Reopening the bug: the warnings are still here,
Updated•27 years ago
|
Assignee: pierre → slamm
Status: REOPENED → NEW
Updated•27 years ago
|
Resolution: FIXED → ---
Comment 9•27 years ago
|
||
Reassigning to slamm who has a Linux box to play with.
| Assignee | ||
Comment 10•27 years ago
|
||
Pretty cool. I am the owner, the reporter, and the QA contact.
I will take a look.
Comment 11•27 years ago
|
||
That will teach you to keep it quiet next time ;-)
I'd be glad to review the code, or come and play with your unix box if you allow
me.
Updated•27 years ago
|
Status: NEW → RESOLVED
Closed: 27 years ago → 27 years ago
Resolution: --- → FIXED
Comment 12•27 years ago
|
||
You know what? It's fixed now... The thing that might have happened is the
following: I checked in, then saw that a new page of warnings was generated and
when I looked into it, the warnings were still there with the new code. The
problem is that the compiler warnings were produced from a tree that did not
contain my checkin and when the web page was constructed it showed links to the
source files that contained my fixes.
Marking fixed. And yes: I did check that these warnings were not listed under
somebody else's name.
| Assignee | ||
Updated•27 years ago
|
Status: RESOLVED → VERIFIED
| Assignee | ||
Comment 13•27 years ago
|
||
I am still unclear why there was a delay, but the warnings are gone. Thank you
for cleaning them up.
Marking VERIFIED.
Updated•10 years ago
|
Product: Core → Core Graveyard
| Comment hidden (collapsed) |
You need to log in
before you can comment on or make changes to this bug.
Description
•