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



--- Comment #5 from Lloyd Dupont <l...@galador.net> 2011-06-24 21:01:19 PDT ---
I found a way to reduce the sample even further.

1st no need to have 2 project (lib & exe). All in the same exe (but different
module) is enough to cause the bug.

==== main.d ====
module main;

import lib;

class Foo
{
    static this()
    {
        Compiled!(Foo, "Subfoo");
    }

    @property public Foo Subfoo() { return null; }
    @property public void Subfoo(Foo f) { }
}

int main(string[] argv)
{
    return 0;
}
====== lib.d ======
module lib;

import std.traits;
import std.stdio;

void Compiled(T, string memberName)()
{
    T t;
    writeln(mixin( "__traits(compiles, t." ~memberName ~" = ("
~typeof(__traits(getMember, T, memberName)).stringof  ~").init)" ));
}
===============

this output "false", whereas it should output "true"

a work around (and simpler code in fact) is to use the following simpler mixin
(in Compiled)
---
writeln(mixin( "__traits(compiles, t." ~memberName ~" = (typeof(t." ~memberName
~")).init)" ));
---

Yet I do think this sample highlight a compiler bug

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

Reply via email to