Why does this work?

h_zet via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 23 01:30:42 PDT 2014


import std.typecons;

auto foo2(R)(R foopara){
     return tuple(foopara, is(R==int));
}

void main(){
     auto tuple(a,b) = foo2(1);
}


I'm expecting some error such as can not act as left value but 
when I compiled this, no error occured. DMD version is DMD64 
v2.065.(ldc2 exited with error function declaration without 
return type)

Why does this work? Or it is a bug?


More information about the Digitalmars-d-learn mailing list