Summary: [CTFE] Local arrays in a recursive local function
                    behave funny
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from 2011-06-16 12:40:49 PDT ---
This is tt.d:

import std.stdio;

string ctfe(){
    int[] ctfe2(int n){
        int[] r=[];
        if(n!=0) r~=[1]~ctfe2(n-1);
        return r;
    return ctfe2(2).length == 2 ?
     "hello from runtime!" : "hello from compile time!";

void main(){

$ dmd -run tt;
hello from compile time!
hello from runtime!

The ctfe'd result is generally longer than the correct one.
The example works as expected if ctfe2 is moved outside ctfe.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to