Bug 23810 – types from core.stdc can't be used in extern(C++) due to aliases being shared

Status
NEW
Severity
major
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-03-27T20:55:11Z
Last change time
2024-12-07T13:42:31Z
Assigned to
No Owner
Creator
ryuukk_
Moved to GitHub: dmd#17458 →

Comments

Comment #0 by ryuukk.dev — 2023-03-27T20:55:11Z
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``
Comment #1 by robert.schadek — 2024-12-07T13:42:31Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17458 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB