[Issue 11157] base class member hides template parameter
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Nov 20 13:35:24 PST 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11157
--- Comment #2 from Martin Nowak <code at dawg.eu> 2013-11-20 13:35:22 PST ---
(In reply to comment #1)
> That's interesting. Would you still expect the template parameter to have
> priority in the expanded case?
>
> template Foo(int param)
> {
> class Foo : Base
> {
> int val()
> {
> return param; // <-- param refers to super.param
> }
> }
> }
Well, it's the same example but it's easier to argue for the current behavior
in the explicit template form.
The bug is that this allows to silently break valid code by changing the base
class definition.
I don't think that it's sane to give the base class scope a higher priority
than any other scope. That is, the same hijack protection that works when
importing two module scopes should work for base class+module, base+interface
and maybe even base+alias this, and alias this+module.
So I would expect "Base.param at bug.d(3) conflicts with param at bug.d(6)".
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list