Bug 13597 – is(typeof()) works only on second call
Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-10-10T14:15:00Z
Last change time
2014-11-01T12:11:19Z
Assigned to
nobody
Creator
andre
Comments
Comment #0 by andre — 2014-10-10T14:15:32Z
The output of the coding is:
Reference: Child
false
true
is(typeof()) works only on second call
-----------------
module app;
import test;
class Child : Parent
{
mixin ComponentTemplate;
@property string childStr(){return "";}
}
void main()
{
auto child = new Child();
child.getParameters();
}
-----------------
module test;
template Params(this MyType)
{
string[] Params()
{
pragma(msg, "Reference: " ~ MyType.stringof);
pragma(msg, is(typeof(__traits(getMember, MyType, "childStr"))));
pragma(msg, is(typeof(__traits(getMember, MyType, "childStr"))));
return [];
}
}
mixin template ComponentTemplate()
{
private enum parameters = Params!(typeof(this));
string[] getParameters()
{
return parameters;
}
}
class Parent
{
@property string parentStr(){return "";}
}
Comment #1 by hsteoh — 2014-10-30T18:08:12Z
Can't reproduce problem in latest dmd git HEAD, the output I get is:
------
Reference: Child
true
true
------
Tested on Linux/64-bit Debian/unstable.
Could it be a Win/64-specific bug?
Comment #2 by andre — 2014-10-30T19:21:00Z
Also I can't reproduce the issue with dmd git head (win 8.1 / 64-Bit).
Therefore I set the status to resolved.
Comment #3 by k.hara.pg — 2014-11-01T12:11:19Z
The issue root is same with the issue 13226, and it is properly fixed in 2.066.
*** This issue has been marked as a duplicate of issue 13226 ***