DMD2 vs LDC2 inliner

James Blachly james.blachly at gmail.com
Tue Feb 26 04:36:59 UTC 2019


> On 2/25/19 2:09 AM, Nicholas Wilson wrote:
>> Leaving aside the issue of why DMD can't handle this, the entire reason
>> pragma(inline, bool) takes a bool is for it to be (potentially) 
>> predicated.
>> In this case you want:
>>
>> version(DigitalMars)
>>       private enum inline_overlaps = false;
>> else // assuming GDC is good
>>       private enum inline_overlaps = true;
>>
>> pragma(inline, inline_overlaps)
>> bool overlaps(IntervalType1, IntervalType2)(IntervalType1 int1, 
>> IntervalType2 int2)
>> {
>>       return ...;
>> }

Sadly, the pragma does not accept enum:

Error: pragma `inline` pragma(inline, true or false) expected, not 
inline_overlaps


More information about the Digitalmars-d-learn mailing list