www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12055] New: Error: basic type expected, not extern when using 'alias = function'

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12055

           Summary: Error: basic type expected, not extern when using
                    'alias = function'
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: ibuclaw ubuntu.com


--- Comment #0 from Iain Buclaw <ibuclaw ubuntu.com> 2014-02-01 05:38:46 PST ---
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.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 01 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12055


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2014-02-01
05:39:44 PST ---
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 *);

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 01 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12055



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2014-02-01
05:40:20 PST ---
(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.. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 01 2014