[Issue 6754] New: extern() in a function signature
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Oct 1 17:22:45 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6754
Summary: extern() in a function signature
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2011-10-01 17:22:06 PDT ---
This comes from code shown in D.learn:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=29886
You can't use extern(C) in a function signature:
void foo(extern(C) void function() f) {}
void main() {}
DMD 2.056head gives:
test.d(1): basic type expected, not extern
test.d(1): found 'extern' when expecting ')'
test.d(1): semicolon expected following function declaration
test.d(1): Declaration expected, not '('
Workaround: before the function definition you have to define the argument type
with an alias:
alias extern(C) void function() CF;
void foo(CF f) {}
void main() {}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list