Phobos: __FILE__ as template default parameter
Johan Engelen via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jul 5 08:58:48 PDT 2016
On Monday, 20 June 2016 at 08:10:19 UTC, Dicebot wrote:
>
> How about defining semantics like "try inlining if possible,
> fallback to always emitting symbol to object file otherwise"?
> That would also allow compatible implementation in dmd.
>
> My reasoning for proposing that is that for all legitimate
> cases I'd have to use __FILE__ as a template argument I'd also
> want the symbol inlined to prevent the bloat. After all CT
> computation such functions tend to contain 1-2 lines of runtime
> code only.
In LDC, Phobos functions with __FILE__ as default template
parameter value are now marked with `pragma(inline, true)`, as a
workaround for the larger issue of what to do with __FILE__ as
template parameter.
https://github.com/ldc-developers/phobos/commit/8b2052cffe159be3db7debbe28ee967630cb4588
(the issue was preventing cross-module inlining, so a workaround
was needed)
More information about the Digitalmars-d
mailing list