Consider:
pragma(inline, true)
int fun(int a, int b)
{
return 3;
}
Upon converting to .di, the code becomes:
pragma(inline, true)int fun(int a, int b);
Inline functions should have their bodies generated in the .di file for obvious reasons.
Comment #1 by ibuclaw — 2015-06-12T14:45:26Z
Setting hardware/platform to all/all, because it's not OSX-specific. ;)
Comment #2 by bugzilla — 2020-06-06T06:37:44Z
This may not be solvable in the general case, consider:
enum T = true;
pragma(inline, T) int fun(int a) { return a; }
The .di files are generated without having the semantic pass run. Hence, T is unknown when the pragma is encountered, i.e. whether it evaluates to true or false is unknown.
Emitting the function body when T is false would be a mistake.
Comment #3 by andrei — 2020-06-06T12:31:30Z
For such cases (I assume there won't be many) it's safe to emit the function unconditionally - it would be no worse than any other approach.
Comment #4 by razvan.nitu1305 — 2022-10-06T09:37:58Z