[Issue 16085] Imported name causes lookup deprecation warning even if masked by member name

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon May 30 07:36:41 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16085

Andrei Alexandrescu <andrei at erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #5 from Andrei Alexandrescu <andrei at erdani.com> ---
(In reply to Martin Nowak from comment #4)
> This is just an occurrence of wrong code caused by issue 314, b/c selective
> imports weren't checked for visibility until recently.
> 
> struct Bucketizer
> {
>     import whatever : reallocate; // <- private
> }
> 
> struct Segregator(LargeAllocator)
> {
>     LargeAllocator _large;
>     void reallocate()
>     {
>         _large.reallocate(); // deprecation
>     }
> }

The issue is subtler than that (I'd agree the snippet above is a clear cut).
The thing is Bucketizer _also_ defines its own reallocate:

struct Bucketizer
{
    import whatever : reallocate; // <- private
    bool reallocate(ref void[] b, size_t size) // <- public
    { ... }
}

struct Segregator(LargeAllocator)
{
    LargeAllocator _large;
    void reallocate()
    {
        _large.reallocate(); // deprecation
    }
}

The member "reallocate" should effectively hide the private import, yet the
deprecation message still appears.

Reopening, feel free to close if you can clarify.

--


More information about the Digitalmars-d-bugs mailing list