[Issue 568] New: Support to implicitly deduce class template in function template

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 18 17:21:13 PST 2006


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

           Summary: Support to implicitly deduce class template in function
                    template
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: lovesyao at hotmail.com


class Test(T){
  T t=T.init;
}

class Test2:Test!(int){};

interface Test3(T){
  static if(is(T==int)){
    T i();
  }else{
    T other();
  }
}

class Test4:Test3!(int),Test3!(float){
  int i(){return 0;};
  float other(){return 0.0;};
};

void test(T)(Test!(T) t){
}

void test2(T)(Test3!(T) t){
}

void main(){
  auto t=new Test!(int);
  auto t2=new Test2;
  auto t3=new Test4;

  test!(int)(t);//ok
  test!(int)(t2);//ok
  test2!(int)(t3);//ok
  test2!(float)(t3);//ok
  test(t);//please support
  test(t2);//please support
  test2(t3);//should be conflict error
}


-- 




More information about the Digitalmars-d-bugs mailing list