March 27, 2023 [Issue 23810] New: types from core.stdc can't be used in extern(C++) due to aliases being shared | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23810 Issue ID: 23810 Summary: types from core.stdc can't be used in extern(C++) due to aliases being shared Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: major Priority: P1 Component: druntime Assignee: nobody@puremagic.com Reporter: ryuukk.dev@gmail.com ndf from IRC: > Hello. I wonder is the following code supposed to compile or not? https://paste.ee/p/RHdiz ``` import core.stdc.stdio; extern(C++) class Base { public: void* LoadFromFilePointer(FILE* fp, int* err); } void main() {} ``` ``` onlineapp.d(6): Error: function `onlineapp.Base.LoadFromFilePointer` cannot have parameter of type `shared(_IO_FILE)*` because its linkage is `extern(C++)` ``` ``FILE`` is aliased: ``alias shared(_iobuf) FILE;`` I personally suggest removing shared from the alias, and developer to let choose what is ``shared`` -- |
Copyright © 1999-2021 by the D Language Foundation