Bug 568 – Support to implicitly deduce class template in function template
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2006-11-18T19:21:00Z
Last change time
2015-06-09T01:31:16Z
Assigned to
nobody
Creator
lovesyao
Comments
Comment #0 by lovesyao — 2006-11-18T19:21:12Z
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
}
Comment #1 by lovesyao — 2006-11-18T19:28:14Z
add example
template Test5(T){
alias int dummy;
class Test5(T t){
T val=t;
}
};
template test3(T){
alias int dummy;
void test3(T t)(Test5!(T).Test5!(t) t){
}
}
void main(){
auto t = new Test5!(int).Test5!(10);
test3!(int).test3!(10)(t);//ok
test3(t);//please support
}
Comment #2 by andrei — 2010-11-26T12:06:46Z
First round of examples now work on 1.065 and 2.050. The second round is invalid.