I have gotten around to doing some disassembly reading, and apparently I was wrong.  DMD does inline nested functions passed as templates, even when they access the outer scope, at least in trivial cases.  D code:<br><br>import std.c.stdio;<br>
<br>void main(string[] args) {<br>    uint num = args.length;  // Make sure this isn&#39;t const folded.<br><br>    bool comp(uint otherNum) {<br>        return otherNum &lt; num;<br>    }<br><br>    // Need to print to keep this from being optimized out entirely.<br>
    printf(&quot;%d&quot;, evalPred!comp(300));<br>}<br><br>bool evalPred(alias pred)(uint num) {<br>    // This line is to make sure that this function doesn&#39;t get inlined into<br>    // main.  DMD doesn&#39;t inline functions that could throw.<br>
    if(num == uint.max) {<br>        throw new Exception(&quot;&quot;);<br>    }<br><br>    return pred(num);<br>}<br><br><br>Disassembly of evalPred!comp:<br><br><span style="font-family: courier new,monospace;">_D4test4mainFAAyaZv45__T8evalPredS29_D4test4mainFAAyaZv4compMFkZbZ8evalPredMFkZb PROC NEAR</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">;  COMDEF _D4test4mainFAAyaZv45__T8evalPredS29_D4test4mainFAAyaZv4compMFkZbZ8evalPredMFkZb</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        push    eax                                     ; 0000 _ 50</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        cmp     dword ptr [esp+8H], -1                  ; 0001 _ 83. 7C 24, 08, FF</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        jnz     ?_006                                   ; 0006 _ 75, 27</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        mov     ecx, offset FLAT:_D9Exception7__ClassZ  ; 0008 _ B9, 00000000(segrel)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        push    ecx                                     ; 000D _ 51</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        call    __d_newclass                            ; 000E _ E8, 00000000(rel)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        add     esp, 4                                  ; 0013 _ 83. C4, 04</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        push    dword ptr [?_004]                       ; 0016 _ FF. 35, 0000000C(segrel)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        push    dword ptr [?_003]                       ; 001C _ FF. 35, 00000008(segrel)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        push    0                                       ; 0022 _ 6A, 00</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        call    _D6object9Exception6__ctorMFAyaC6object9ThrowableZC9Exception; 0024 _ E8, 00000000(rel)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        push    eax                                     ; 0029 _ 50</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        call    __d_throw@4                             ; 002A _ E8, 00000000(rel)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">?_006:  mov     eax, dword ptr [esp]                    ; 002F _ 8B. 04 24</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        mov     edx, dword ptr [eax]                    ; 0032 _ 8B. 10</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        mov     eax, 1                                  ; 0034 _ B8, 00000001</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        cmp     edx, dword ptr [esp+8H]                 ; 0039 _ 3B. 54 24, 08</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        ja      ?_007                                   ; 003D _ 77, 02</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        xor     eax, eax                                ; 003F _ 31. C0</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">?_007:  pop     ecx                                     ; 0041 _ 59</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        ret     4                                       ; 0042 _ C2, 0004</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">_D4test4mainFAAyaZv45__T8evalPredS29_D4test4mainFAAyaZv4compMFkZbZ8evalPredMFkZb ENDP</span><br><br>