[Issue 13597] New: is(typeof()) works only on second call
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Oct 10 07:15:32 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13597
Issue ID: 13597
Summary: is(typeof()) works only on second call
Product: D
Version: D2
Hardware: x86_64
OS: Windows
Status: NEW
Severity: major
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: andre at s-e-a-p.de
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 "";}
}
--
More information about the Digitalmars-d-bugs
mailing list