Bug 12300 – Deprecated variables still accessible using tupleof
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2014-03-05T12:49:00Z
Last change time
2014-03-19T02:30:22Z
Keywords
accepts-invalid, industry
Assigned to
nobody
Creator
mathias.baumann
Comments
Comment #0 by mathias.baumann — 2014-03-05T12:49:51Z
DMD shows inconcistent behavior when checking for the existance of a deprecated variable in a struct as the code below shows:
-----
module main;
struct S
{
deprecated int var;
}
void main ()
{
S s;
// Works
static assert ( is ( typeof(s.tupleof[0]) ), "s.tupleof[0] does not exist!" );
// Fails
static assert ( is ( typeof(s.var) ), "s.var does not exist!" );
}
-------
Comment #1 by mathias.baumann — 2014-03-05T12:52:04Z
A short test showed that it works in D2
Comment #2 by public — 2014-03-06T06:25:53Z
x-post from internal discussion:
-----
It clearly does not work in D2 for me:
$ dmd -de -run test.d
test.d(17): Error: static assert "s.var does not exist!"
You may have missed the fact that dmd2 uses different set of flags to control deprecation behaviour.
-----
I think this is by design and works as intended.