[Issue 20925] New: pragma(inline) should emit code to the calling CU + appropriate linker flags
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jun 13 02:07:48 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20925
Issue ID: 20925
Summary: pragma(inline) should emit code to the calling CU +
appropriate linker flags
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: turkeyman at gmail.com
inline functions should be emit to the calling CU.
they should be assigned an appropriate link flag such that linker appropriately
handles duplicate symbols:
inline = 'linkonce' (like `inline` in C)
private inline = 'internal' (like `static inline` in C)
ie; LLVM enumerates the linker flags:
https://llvm.org/docs/LangRef.html#linkage-types
Specifically, this should work:
---------------------
lib.d
-----
module lib;
pragma(inline, true)
void inl() {}
test.d
------
import lib;
int main()
{
inl();
return 0;
}
---------------------
Expect:
> dmd test.d
No link error!
Currently:
> error LNK2019: unresolved external symbol "void lib.inl()" (__D3lib3inlFZv) referenced in function __Dmain
--
More information about the Digitalmars-d-bugs
mailing list