[Issue 7482] deprecation isn't checked inside forward referenced typeof()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 16 12:28:49 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7482


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|deprecation isn't checked   |deprecation isn't checked
                   |inside forward referenced   |inside forward referenced
                   |is(typeof())                |typeof()


--- Comment #5 from Don <clugdbug at yahoo.com.au> 2012-02-16 12:28:46 PST ---
> Deprecation is most definitely not about declarations not existing. It is about being an error to reference them.
Right, but is(typeof(X)) isn't a check if X exists, even though a popular idiom
is to use it for that purpose. Rather, it asks what type X has. And I think
that has to be considered as referencing X, and is therefore an error.
If it's not an error, it has to be able to provide a type, and that's a
problem:

static if (is(typeof(Z)  M)) {
    M we_are_relying_on_a_deprecated_variable;
}

deprecated int Z;

But it turns out that this bug has nothing to do with is().

alias typeof(Z) Q1; // compiles

deprecated int Z;

alias typeof(Z) Q2; // doesn't compile


In fact, it seems it doesn't even require deprecated:

alias typeof(Z1) Q1;
pragma(msg, Q1.stringof); // int

const int Z1;

alias typeof(Z1) R1;
pragma(msg, R1.stringof); // const(int)

and yet if you write const (int) Z1; it displays const(int) in both cases.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list