Constructor params with same name as members

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Oct 22 22:33:02 PDT 2014


On Thu, Oct 23, 2014 at 11:01:10AM +0530, Shriramana Sharma via Digitalmars-d-learn wrote:
> Hello. I perfectly realize that it's not advisable to take advantage
> of shadowing. In fact, I asked the question because I thought D
> specifically *didn't* allow shadowing, but here it is, being silently
> permitted to mishappen... I seem to read to have read that (D didn't
> allow shadowing) but I'm not able to point to where...
> 
> BTW I compiled it with LDC 0.14.0 and separately with D 2.066.0 and
> both give the same result.
> 
> So shouldn't the compiler ideally complain about the arguments
> shadowing members?
[...]

File a bug, if one isn't already filed. (I vaguely seem to recall an
existing bug to that effect, but I could be wrong.)


T

-- 
What do you call optometrist jokes? Vitreous humor.


More information about the Digitalmars-d-learn mailing list