无法使用receiveOnly的别名

时间:2016-04-17 10:29:37

标签: d

public alias Message = int;
void threadFunc(){
    import std.concurrency;
    while(true){
        auto m = receiveOnly!(Message);
    }
}

void main(){
    import core.thread;
    import std.concurrency;

    auto t = spawn(&threadFunc);
}
  

错误:ScopeDsymbol breeze.concurrency.task .__ anonymous .__ anonymous struct std.concurrency.Message是私有的

我无法使用receiveOnly的别名。似乎D将它们设为私有我的默认值,但我明确将Message标记为公开,但错误仍然存​​在。

1 个答案:

答案 0 :(得分:4)

问题是别名Message的名称与std.concurrency中的私有结构冲突。这已在2.071.0版本中修复。因此,您可以将别名的名称升级或更改为其他名称。

更多信息:https://dlang.org/changelog/2.071.0.html#dip22和此处:http://www.schveiguy.com/blog/2016/03/import-changes-in-d-2-071/