http://d.puremagic.com/issues/show_bug.cgi?id=8653

           Summary: cannot take address of auto-return function declared
                    in outside module: "Error: forward reference"
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: thelastmamm...@gmail.com


--- Comment #0 from thelastmamm...@gmail.com 2012-09-13 17:56:27 PDT ---
See the following code for CT error.
It seems we cannot take address of auto-return function declared in outside
module, but we can if it's declared in the same module. 
The CT error is: "Error: forward reference"


file main.d:
----
import fun;

void run3(Fun,T...)(Fun fun,T args){
    fun(args);
}

class A1{
    void fun1(double x){
    }
    double fun2(double x){
        return x;
    }
    auto fun3(double x){
        return x;
    }
    auto fun4(double x){
    }
}

void main(){
    test1;
    test2;
}
void test1(){
    auto a=new A1;
    run3(&a.fun1,1);
    run3(&a.fun2,1);
    run3(&a.fun3,1);
    run3(&a.fun4,1);
}

void test2(){
    auto a=new A2;
    run3(&a.fun1,1);
    run3(&a.fun2,1);
    run3(&a.fun3,1);//CT error
    run3(&a.fun4,1);//CT error
}


-----

file fun.d:
----
module fun;

class A2{
    void fun1(double x){
    }
    double fun2(double x){
        return x;
    }
    auto fun3(double x){
        return x;
    }
    auto fun4(double x){
    }
}
----

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to