Bug 12055 – Error: basic type expected, not extern when using 'alias = function'
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-02-01T05:38:00Z
Last change time
2017-07-02T15:39:09Z
Assigned to
nobody
Creator
ibuclaw
Comments
Comment #0 by ibuclaw — 2014-02-01T05:38:46Z
In D, you can now replace the following:
alias int _UnWind_Sword;
=>
alias _UnWind_Sword = int;
However, this doesn't seem to work with alias function.
// OK
alias extern(C) void function(_Unwind_Reason_Code, _Unwind_Exception *)
_Unwind_Exception_Cleanup_Fn;
// Error
alias _Unwind_Exception_Cleanup_Fn
= extern(C) void function(_Unwind_Reason_Code, _Unwind_Exception *);
I would expect this to work in the same way as the first example does.
Comment #1 by andrej.mitrovich — 2014-02-01T05:39:44Z
Known bug, not sure if it was filed before. The workaround is to mark the alias as extern(C):
extern(C) alias _Unwind_Exception_Cleanup_Fn
= void function(_Unwind_Reason_Code, _Unwind_Exception *);
Comment #2 by andrej.mitrovich — 2014-02-01T05:40:20Z
(In reply to comment #1)
> Known bug, not sure if it was filed before. The workaround is to mark the alias
> as extern(C):
>
> extern(C) alias _Unwind_Exception_Cleanup_Fn
> = void function(_Unwind_Reason_Code, _Unwind_Exception *);
Heh, I missed your OK sample there where you say the same thing. Sorry for the noise..
Comment #3 by dlang-bugzilla — 2017-07-02T15:39:09Z