[Issue 20153] New: extern for aliased template instantiation
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Aug 22 15:08:26 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20153
Issue ID: 20153
Summary: extern for aliased template instantiation
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: black80 at bk.ru
I want to export non-mangled instantiated through alias template function.
it can be useful for WASM, DLLs/SharedLibs and etc.
but alias for template instatiation is ignored.
pragma mangle to alias is ignored too.
-----------------------------------
void main() {}
export: // EXPORTed
extern (C): // NO MANGLE but IGNORED
public:
void fun( Char )( Char* ) { }
pragma (mangle, "func") // IGNORED
alias func = fun!char;
pragma( msg, func.mangleof );
pragma (mangle, "funw") // IGNORED
alias funw = fun!wchar;
pragma( msg, funw.mangleof );
------------ OUTPUT -----------------------
_D9onlineapp__T3funTaZQhUNaNbNiNfPaZv
_D9onlineapp__T3funTuZQhUNaNbNiNfPuZv
current workaround: wrap template funcs to non-template.
possible solution:
if "alias" locates in non-mangle block (extern(C) for example) then do not
mangle name and check that no others entities with same name exists in current
context.
OR/AND
make "pragma mangle" working for alias-es too.
--
More information about the Digitalmars-d-bugs
mailing list