[Issue 23810] New: types from core.stdc can't be used in extern(C++) due to aliases being shared
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 27 20:55:11 UTC 2023
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 at puremagic.com
Reporter: ryuukk.dev at 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``
--
More information about the Digitalmars-d-bugs
mailing list